Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Unsubscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Date: Thu, 12 Aug 99 19:42:11 PDT From: jim AT nga DOT com (Jim Roy) Message-Id: <9908130242.AA22543@nga.nga.com> To: cygwin AT sourceware DOT cygnus DOT com Subject: freopen() problems The following code works on at least one persons system. On mine, the freopen() call for one stream wipes out the other. If I uncomment the second pair, all the reads/writes work fine. This is a win98 system. I'v upgraded to 2.95 versions of gcc and mingw-extras I'm not geting the cygwin.dll by mistake. I'm using -mwindows, and -mno-cygwin. I'm at my wits end. I will be most grateful for ideas about what's left to double check? ----- Begin Included Message ----- #include #include #include #include main (argc, argv) int argc; char *argv[]; { char answer[80]; HANDLE handlein, handleout; handlein = GetStdHandle (STD_INPUT_HANDLE); handleout = GetStdHandle (STD_OUTPUT_HANDLE); if (handleout == INVALID_HANDLE_VALUE) { AllocConsole (); } freopen ("CONOUT$", "w", stdout); printf( "Thanks Tor\n" ); freopen ("CONIN$", "r", stdin); fscanf( stdin, "%s", answer ); /* freopen ("CONOUT$", "w", stdout); */ fprintf( stdout, "%s\n", answer); /* freopen ("CONIN$", "r", stdin); */ fscanf( stdin, "%s", answer ); fprintf( stdout, "%s\n", answer); while(1); } int _stdcall WinMain (HANDLE hInstance, HANDLE hPrevInstance, char *lpszCmdLine, int nCmdShow) { return main (__argc, __argv); } ----- End Included Message ----- -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com