-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to C-Programmer on 12/3/2008 6:29 PM: > But if I compile using the following command line argument: > $ gcc -mno-cygwin -o ioProg1 ioProg1.c
Then you are no longer using cygwin, and this is almost more of a question for the mingw list. > I find that the DLL being used is msvcrt.dll and the program behaves as if > the gets( name ); line had come before the printf("What is your name?"); > line. Very strange! > > Any ideas on why this is happening? Yes. It's called buffering. Native Windows apps have no idea that cygwin emulates pty's with pipes, and blindly assume that all pipes are non-interactive. For performance reasons, when talking to a non-interactive client, all stdio libraries perform block buffering instead of line buffering when stdout is determined to be non-interactive. So, because you are running a native windows app in a cygwin console, your app doesn't realize that you wanted line buffering, and so you don't see output until 4k or end of process, even though the printf completed before the gets. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkk3NVQACgkQ84KuGfSFAYBbLgCg1fPBj1EjWjV//aa8FZ5+TSNA 4KUAoKiFDW6hFR0hJD857TNEa7gSAiFK =usqi -----END PGP SIGNATURE----- -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/