Mail Archives: cygwin/1999/08/12/22:43:18
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 <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
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
- Raw text -