From: Rolf K. <lab...@us...> - 2005-06-12 13:48:22
|
Update of /cvsroot/opengtoolkit/pipe/c_source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13307/c_source Modified Files: pipes.dsw Added Files: client.c Log Message: Add test client application --- NEW FILE: client.c --- #include <windows.h> #include <stdio.h> #ifdef _DEBUG #define DebugBreaking() {__asm int 3} #else #define DebugBreaking() #endif #define BUFSIZE 4096 VOID main(VOID) { CHAR chBuf[BUFSIZE]; DWORD dwRead, dwWritten; HANDLE hStdin, hStdout, hStderr; BOOL fSuccess; DebugBreaking(); hStdout = GetStdHandle(STD_OUTPUT_HANDLE); hStdin = GetStdHandle(STD_INPUT_HANDLE); hStderr = GetStdHandle(STD_ERROR_HANDLE); if ((hStdout == INVALID_HANDLE_VALUE) || (hStdin == INVALID_HANDLE_VALUE) || (hStderr == INVALID_HANDLE_VALUE)) ExitProcess(1); // Write welcome message to standard output. sprintf(chBuf, "Standard IO Loopback program\r\n9. June 2005\r\n"); fSuccess = WriteFile(hStdout, chBuf, strlen(chBuf), &dwWritten, NULL); if (!fSuccess) ExitProcess(2); for (;;) { // Read from standard input. fSuccess = ReadFile(hStdin, chBuf, BUFSIZE, &dwRead, NULL); if (! fSuccess || dwRead == 0) { DWORD err = GetLastError(); sprintf(chBuf, "error = %d, dwRead = %d\r\n", err, dwRead); WriteFile(hStderr, chBuf, strlen(chBuf), &dwWritten, NULL); break; } // Write to standard output. fSuccess = WriteFile(hStdout, chBuf, dwRead, &dwWritten, NULL); if (!fSuccess) { DWORD err = GetLastError(); sprintf(chBuf, "error = %d, dwRead = %d\r\n", err, dwRead); WriteFile(hStderr, chBuf, strlen(chBuf), &dwWritten, NULL); break; } } } Index: pipes.dsw =================================================================== RCS file: /cvsroot/opengtoolkit/pipe/c_source/pipes.dsw,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pipes.dsw 11 Mar 2004 08:18:55 -0000 1.1 --- pipes.dsw 12 Jun 2005 13:48:12 -0000 1.2 *************** *** 4,7 **** --- 4,19 ---- ############################################################################### + Project: "client"=.\client.dsp - Package Owner=<4> + + Package=<5> + {{{ + }}} + + Package=<4> + {{{ + }}} + + ############################################################################### + Project: "pipes"=.\pipes.dsp - Package Owner=<4> |