-donbock
ha ha.. main problem is that only.. if i have a proper function to return immediately, i never go for threads and alarm and timers all these. okay you came to my point. Now give your ideas about immediate returning(atlea st 2 sec) from getline() either with a success or failure .. ??
thanks
User Profile
Collapse
-
thank you -weaknessforcats
i already got the solution using <pthreads>
Now, i dnt want to use that. is there any other way to solve the same problem ..?? Challenging one... !!
thanksLeave a comment:
-
-weaknessforcats
Exactly... but, not in wait. In that 5 sec time it needs to go to some other function and come back to the same getline(). Then with in 5 sec if i not entered any string, then again it has to got to that function and come back (looping)..
Main purpose is__ Timer for getline(), with in that time it needs to execute another function and come back .. any ideas ??
thanksLeave a comment:
-
thnq suvarna.. it worked well.
But, at last it is giving one message "Alarm clock". How to suppress that one ??? and also if i want to do another task after 5 sec with exiting from program.. is this one also possible ??
-suvarna271Leave a comment:
-
timer for getline() function
hiii all
i want to read a string from commandline through getline() in c++. For that i want to add a timer of 5 sec. If no string read, then the program will terminate. can anybody know ?? I am using Centos 6.3
thanks -
Thank you @weaknessforcat s
My program is running. The actual thing is that i want that the control have to do multiple tasks in my program. if i enter data in commandline and hit enter it wanna go to send function, read data and send. If i am not typing anything then it will be in receiving mode..( Like chat program). For this one i don't want to use threads, bcozz program becomes complex. that's why i questioned about commandline. Is there...Leave a comment:
-
thank you soo much @Banfa
But, is there any equivalent method in c++, like CommandLine BufferedReader in java ????Leave a comment:
-
how to know commandline is empty or not ??
hello.. everyone
i am writing a c++ program in Linux..
i am reading a line from commandline at run time using "getline(std::c in,str);". now, what i want is if i left the commandline as idle (terminal as idle), then i want to know that the commandline is empty... is it possible ???
any comment is appreciable..
thank you
No activity results to display
Show More
Leave a comment: