I'm a VC++ newbie!
I am trying to read from a pipe and then write the data to a textfile. I can read from the pipe and put the data into my dialog but it won't write the data to a text file. I know that it is opening the file and it does write the test "hello's" but not data from the pipe.
Here is the code that reads from the pipe:
FILE *stream;
char buffer[1024];
.
.
.
stream = fopen( "number", "w" );
fprintf( stream, "Hello\n" //This goes to the text file
//Read from the pipe
ReadFile(hReadPipe, buffer, 1024, &bytesread, NULL);
fprintf( stream, "Hello2 %s \n", buffer); //Hello2 goes to the text file but nothing else
//send the message from the pipe to the edit box.
SendDlgItemMessage(hDlg, EDIT1, EM_SETSEL, -1, 0);
SendDlgItemMessage(hDlg, EDIT1, EM_REPLACESEL, FALSE, (LPARAM)buffer);
fclose( stream );
Thanks.
I am trying to read from a pipe and then write the data to a textfile. I can read from the pipe and put the data into my dialog but it won't write the data to a text file. I know that it is opening the file and it does write the test "hello's" but not data from the pipe.
Here is the code that reads from the pipe:
FILE *stream;
char buffer[1024];
.
.
.
stream = fopen( "number", "w" );
fprintf( stream, "Hello\n" //This goes to the text file
//Read from the pipe
ReadFile(hReadPipe, buffer, 1024, &bytesread, NULL);
fprintf( stream, "Hello2 %s \n", buffer); //Hello2 goes to the text file but nothing else
//send the message from the pipe to the edit box.
SendDlgItemMessage(hDlg, EDIT1, EM_SETSEL, -1, 0);
SendDlgItemMessage(hDlg, EDIT1, EM_REPLACESEL, FALSE, (LPARAM)buffer);
fclose( stream );
Thanks.