Mail Archives: cygwin/1998/12/06/14:41:14
I found that using ^J instead of enter gives the correct results.
Take this small bit of code:
#include <stdio.h>
char string[5];
char *fgets_ptr;
int main() {
fgets_ptr = fgets(string, sizeof(string), stdin);
string[strlen(string)-1] = '\0';
printf("fgets_ptr is %s and string is %s\n", fgets_ptr, string);
return(0);
}
Yeilds this when using "Enter" to execute it:
BASH.EXE-2.02$ ./fgetstest.exe
fgets_ptr is and string is
But yeilds this when using ^J:
BASH.EXE-2.02$ ./fgetstest.exe^J
asd
fgets_ptr is asd and string is asd
Paul
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -