Subj : Input without Carriage Return (Enter) To : Nightfox From : Mercyful Fate Date : Wed Sep 16 2009 12:49 pm Re: Input without Carriage Return (Enter) By: Nightfox to Jon Justvig on Thu Aug 06 2009 18:28:56 > 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 th > 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. I think in Visual Studio, i'm a little foggy, but conio useta be present in VS as of 6.0.. so you can #include i think in more recent versions, i haven't played with any .NET though.. but i remember being able to just include then just adding the following to my header to get access to teh console input functions. #ifdef __cplusplus extern "C" { #endif char*_cgets (char*); int_cprintf (const char*, ...); int_cputs (const char*); int_cscanf (char*, ...); int_getch (void); int_getche (void); int_kbhit (void); int_putch (int); int_ungetch (int); intgetch (void); intgetche (void); intkbhit (void); intputch (int); intungetch (int); #ifdef __cplusplus } #endif then just calling getch() would get a hotkey. --- þ Synchronet þ Digital Distortion: digitaldistortionbbs.com .