02-22-2005
Quote:
Originally Posted by uxbala
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 wait for
// some 20 seconds for the user input if he is not
// provided the input by that time use default
switch(sex)
{
case 'F' :
// do something
break ;
default :
case 'M' :
// do something
break ;
}
retrurn 0 ;
}
Thanks In advance.
Balasubramnaian
see non blocking read() help, you can do with that
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
UCIMF(1) General Commands Manual UCIMF(1)
NAME
ucimf - unicode console input method framework
DESCRIPTION
ucimf is an input method framework designed for Linux unicode console.
FEATURE
o Support UTF-8
o Support OpenVanilla Modules
o Support PCF, TrueType Font
o Provide OverSpot style compose window
o Provide C/C++ API
BOOT PARAMETERS
Framebuffer mode is needed.
You can add "vga=XXX" to LILO, GRUB, or other bootloaders to let the kernel start with proper framebuffer mode automatically.
vga=785 (640x480, 16 ), vga=788 (800x600, 16 ), vga=791 (1024x768, 16 ), vga=794 (1280x1024, 16 )
USAGE
ucimf needs to run under an UTF-8 consle environment, please use locale -a to see the UTF-8 locales that your system is supported and use
command like export LC_ALL=zh_CN.UTF-8 to set up the locale.
To start ucimf with FbTerm, prefer to install fbterm-ucimf package and run fbterm -i fbterm_ucimf, or see ucimf_start(1) as an not-recom-
mended alternate.
When the user is running an FbTerm, key combination Ctrl+Space is the switch of enable/disable the input method, Ctrl+ShiftLeft to switch
to next input method, and Ctrl+ShiftRight to switch to next input method framework.
For jfbterm, F12 is the switch of enable/disable the input method, F11 to switch to next input method, and F10 to next input method frame-
work.
If the user wishes to use Ctrl+Space and Ctrl+ShiftLeft under jfbterm, please use ucimf_keyboard, which maps Ctrl+Space to F12, and
Ctrl+ShiftLeft to F11.
TABLE MANAGEMENT
ucimf use standard *.cin files directly to manage its input method tables, per-user input method tables is put in
~/.openvanilla/OVIMGeneric/.
Installing or removing a table is simply copy or remove a file in that directory.
The order of loading table is managed by the name of the table files, for exaple you can name your tables like this:
01_xxx.cin, 02_xyz.cin, 03_aaa.cin, ...
ucimf will follow this order while loading input method tables.
SHELL ENVIRONMENT
LC_CTYPE - use UTF-8 as to recogize characters. For example:
export LC_CTYPE=zh_CN.UTF-8
OVMODULE_DIR - to customize OpenVanilla modules location at run-time. For example:
export OVMODULE_DIR=/usr/lib/openvanilla/
SEE ALSO
ucimf_start(1), ucimf_keyboard(1), ucimf.conf(5).
AUTHOR
libucimf was written by Chun-Yu Lee (Mat) <MatLinuxer2@gmail.com> and Jim Huang <jserv.tw@gmail.com>.
This manual page was written by Aron Xu <happyaron.xu@gmail.com>, for the Debian project (and may be used by others).
January 29, 2010 UCIMF(1)