02-08-2005
How to Get Timed Input using cin
Hi,
I am trying to get the input like option from the user using cin but if the user is not responding for some time I want to use the default value which does not need users interaction can any one help to do this in unix c++?
int main()
{
char sex = 'M' ;
cout << "Are you Male/Female (M/F)?" << flush ;
cin >> setw(1) >> sex ; // Here I don't want to wait indefinatily
switch(sex)
{
case 'F' :
// do something
break ;
default :
case 'M' :
// do something
break ;
}
retrurn 0 ;
}
Thanks In advance.
Balasubramnaian
8 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I connect to a Sun Box through telnet but it timed out in couple of minutes.
Advance thanks for any idea...help... (2 Replies)
Discussion started by: s_aamir
2 Replies
2. UNIX for Advanced & Expert Users
We recently installed a new release of SCO UNIX (5.0.6) and when I try to relay e-mail from the UNIX box to my NT server (the mail server) I get the following message from sendmail.
Deferred: Connection timed out with nt
I have nt set up as my relay server in sendmail.cf and the mail seems to... (8 Replies)
Discussion started by: jmossman
8 Replies
3. UNIX for Dummies Questions & Answers
Hello,
How can I set up events to be executed at a certain time? And do I need some kind of privilege such as being in cron group? (2 Replies)
Discussion started by: rayne
2 Replies
4. HP-UX
I am trying to connect with my hp machine using "dialup networking." It times out after 30 seconds. Is there a way to adjust this time. Would it have anything to do with rexec?
thanks (0 Replies)
Discussion started by: paschal
0 Replies
5. Programming
Is there any way in which I can make my wait signal to wait for a specified time for child job to complete. And if that time is over, the program gets out of the wait signal to process other things (4 Replies)
Discussion started by: anjul_thegreat
4 Replies
6. Programming
Hi, I have recently started using C++. I use g++ on Unix. I could not get a simple C++ program working.
The program is;
#include <iostream>
using namespace std;
int main()
{
double a, b;
cout << "enter your number";
cin >> a;
b = a + 1.15;
... (4 Replies)
Discussion started by: apprentice
4 Replies
7. Solaris
I have Ultra 45 Sun solaris box with Solaris 10 installed.
My problem is when i boot the unix box, i got the message:
What does this message meant?
then it does not continue to boot successfully.
Please help. Thanks in advance. (5 Replies)
Discussion started by: etcpasswd
5 Replies
8. Shell Programming and Scripting
Hi all
I need a little bit of help, i am looking for a script that can have different events in it and then if it is a certain day email me about it
some sort of email reminder system
any ideas
thanks (4 Replies)
Discussion started by: ab52
4 Replies
LEARN ABOUT SUNOS
atok12mngtool
atok12mngtool(1m) System Administration Commands atok12mngtool(1m)
NAME
atok12mngtool - Administrates ATOK12 user information
SYNOPSIS
/usr/sbin/atok12mngtool
AVAILABILITY
JSatsvu
DESCRIPTION
The atok12mngtool command provides ATOK12 user information administration operations. This utility needs to be executed by superuser, and
multiple processes cannot run simultaneously.
When invoked, atok12mngtool enters its command interpreter and awaits instructions from the user. When atok12mngtool is awaiting commands
from the user, it displays the prompt Command>.
OPTIONS
The following options may be specified to the command interpreter:
a Adds (registers) a user with a specified name. Usually you do not need to use this option because any user who attempts to
use ATOK12 will be registered automatically.
d Deletes (Unregisters) a user with a specified name.
l Lists names of users who have been registered to use ATOK12. atok12mngtool starts printing user information after all user
information has been processed. A plus symbol ('+') will be printed every after 100 users are processed.
q Quits this utility.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
>0 An error occurred.
FILES
/usr/sbin/atok12mngtool
ATOK12 user information administration utility
SEE ALSO
environ(5)
Japanese Input System Summary & Transition
ATOK12 User's Guide
SunOS 5.10 10 Jan 2003 atok12mngtool(1m)