I am writing a double number in Binary format to the console of program A (in FORTRAN) with the following code:
And trying to read that number by program B (in C++) which is connected to program A by anonymous pipes. Following is the reading part of program B:
A = 12.54
INQUIRE(6, name = xstring)
WRITE (1) A
Note: V_hChildStd_OUT_Rd is a handle to the output of program A.
#define BUF_SIZE 5000
BOOL bSuccess = FALSE;
bSuccess = ReadFile( V_hChildStd_OUT_Rd, Buf, BUF_SIZE, &dwRead, NULL);
if( ! bSuccess || dwRead == 0 ) break;
After running the program although bSuccess becomes TRUE, Buf array does not include the number (12.54) that I am expecting. If I do the same process without using the binary format it works fine and I can read the number. I know somethings wrong with the writing or reading of binary data but I do not know what it is.
I would appreciate if someone can help me. Thanks!