Subj : Input without Carriage Return (Enter) To : Jon Justvig From : Nightfox Date : Thu Aug 06 2009 06:28 pm Re: Input without Carriage Return (Enter) By: Jon Justvig to All on Thu Aug 06 2009 15:22:01 > > compile both in Linux and DOS, I need to be able to just enter one charac > > from the keyboard to issue a command without hitting the enter key or a > > carriage return. How would I code the input portion after a menu of > > commands has been displayed on the console? I don't think such a function exists in standard C++ or C. One thing you could do is to write your own function for inputting a character from the user and implement it differently, depending on which platform you're compiling on. You'd have the function decleared in a header file, and you can have the implementation in separate .cpp files (one for each platform), or a single .cpp file with pre-processor diretives around the implementations so you can give the pre-processor the appropriate flag, and it would compile the appropriate code in the .cpp file. In Win32, there may be functions provided that do this. This page on Microsoft's MSDN site describes ReadConsole() - I haven't used this, but it may do what you want (although it looks a bit more complicated to use than cin): http://msdn.microsoft.com/en-us/library/ms684958%28VS.85%29.aspx The Linux implementation could use the nCurses library. nCurses has functions for getting a single character, such as getch(), wgetch(), etc.: http://www.mkssoftware.com/docs/man3/curs_getch.3.asp I hope this helps. Eric --- þ Synchronet þ Digital Distortion: digitaldistortionbbs.com .