Command line I/O question [message #187735] |
Mon, 19 March 2007 22:34 |
Eclipse User |
|
|
|
Originally posted by: kr4z33.yahoo.com
I figured out how to build and run a C program I am working on using the
gnu compiler, eclipse 3.2.1, and cdt. cool so far :)
The program I am working on relies on textual command line input, i have
a function to get strings with multiple lines up to a certain length of
characters, n. to stop inputting before the maximum length a user is
asked to hit the ESC key (ASCII no. 27) and enter. The function works on
nix and windows command line, in the eclipse console, it seems that the
ESC key is overlooked. heres the function:
void getMultilineString(char *string, int n)
{
char input;
int i = 0;
while((input = getc(stdin)) != 27 && i < n)
{
string[i] = input;
i++;
}
string[i] = '\0';
}
any ideas?
|
|
|
Powered by
FUDForum. Page generated in 0.03719 seconds