G
Guest
I am running in debugging mode after a clean C++ compilation under .NET 2003. In a BIG loop (controlled many levels up in the call stack), I open a file with fopen using the "a" option. Then I write 23 doubles to it with fwrite, one call for each double. Then I close the file using fclose. After three times around the loop in the debugger, I stop the program (using "Stop debugging"). That is writing 552 bytes.
The resulting file's properties window says it is the file size is 555 bytes.
I read the file using another program (MATLAB). The first 37 doubles are exactly what they should be. The rest are seemingly random numbers with large (positive and negative) exponents. I have used this version of MATLAB to read binary data files a great many times without problems, so I don't think the problem is on that end.
I have gotten the exact same crazy behavior calling frwrite with a pointer to an array of doubles holding the 23 values and many various on that theme. I tried using (o)fstream instead of C-style calls initially but ran into a problem compiling the fstream header file (see my previous posting). I expect to be writing some very large data files and would really prefer to ues binary I/O as opposed to formated.
Has anyone else had similar problems? If so, how did you fix them or work around them?
Does the .NET 2003 development environment have a tool like the UNIX "od" which would let me inspect the binary file I create?
Thanks any advance for any assistance,
John
The resulting file's properties window says it is the file size is 555 bytes.
I read the file using another program (MATLAB). The first 37 doubles are exactly what they should be. The rest are seemingly random numbers with large (positive and negative) exponents. I have used this version of MATLAB to read binary data files a great many times without problems, so I don't think the problem is on that end.
I have gotten the exact same crazy behavior calling frwrite with a pointer to an array of doubles holding the 23 values and many various on that theme. I tried using (o)fstream instead of C-style calls initially but ran into a problem compiling the fstream header file (see my previous posting). I expect to be writing some very large data files and would really prefer to ues binary I/O as opposed to formated.
Has anyone else had similar problems? If so, how did you fix them or work around them?
Does the .NET 2003 development environment have a tool like the UNIX "od" which would let me inspect the binary file I create?
Thanks any advance for any assistance,
John