Hi folks, long time lurker first post here.
Does anyone have any experience of reading & writing a file created by another MFC application?
The application is placing arrays into a file.
Thanks
Reading / writing file created by C++ MFC application
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 3
- Joined: Fri Jun 25, 2010 11:34 am
Re: Reading / writing file created by C++ MFC application
Hi supremisewan,
I have no idea what a MFC application is, but here some questions that may help us help you
1. Is this a plain text or binary file?
2. If it is a text file, do you know HOW (format) the arrays are written to that file?
3. Mabe you could post an example of these files here?
Best form germany
Klaus
I have no idea what a MFC application is, but here some questions that may help us help you

1. Is this a plain text or binary file?
2. If it is a text file, do you know HOW (format) the arrays are written to that file?
3. Mabe you could post an example of these files here?
Best form germany
Klaus
-
- Posts: 3
- Joined: Fri Jun 25, 2010 11:34 am
Re: Reading / writing file created by C++ MFC application
Hi Klaus
Thanks for your quick reply.
MFC is Microsoft Foundation Class libraries. We use the CArchive class (part of mfc) to serialize the objects for the file. The applications are c++ MFC applications.
I know the exact format of the files (there are several different types) all are unicode binary files.
They generally contain a mixture of information, header, filetype (internal version number) Then a series of arrays-
for example a typical basic structure would be -
(index, array(position1, position2, position3), attribute, attribute) (index2, array(position4, position5), attribute, attribute)
Im not even 100% if this will even be possible in revolution without an external, but i have my fingers crossed.
I have figured out how to get rev to read the binary file, and process different types as binary, what is stumping me is how to deal with the arrays.
Thanks for your quick reply.
MFC is Microsoft Foundation Class libraries. We use the CArchive class (part of mfc) to serialize the objects for the file. The applications are c++ MFC applications.
I know the exact format of the files (there are several different types) all are unicode binary files.
They generally contain a mixture of information, header, filetype (internal version number) Then a series of arrays-
for example a typical basic structure would be -
(index, array(position1, position2, position3), attribute, attribute) (index2, array(position4, position5), attribute, attribute)
Im not even 100% if this will even be possible in revolution without an external, but i have my fingers crossed.
I have figured out how to get rev to read the binary file, and process different types as binary, what is stumping me is how to deal with the arrays.
Re: Reading / writing file created by C++ MFC application
Well, if you've figured out how to extract the various binary formats you've already done the hard part <g>. You'll have to do some more reverse engineering to figure out the stored format of the data (whether it's packed, etc), but from that point on it's just a matter of reading a certain number of bytes and converting them. No external necessary.
BTW: Your "basic structure" looks like structs rather than arrays. If that's the case, then "array(position1, position2, position3)" will evaluate to a known type (int, real, etc) and you can go from there.
BTW: Your "basic structure" looks like structs rather than arrays. If that's the case, then "array(position1, position2, position3)" will evaluate to a known type (int, real, etc) and you can go from there.
-
- Posts: 3
- Joined: Fri Jun 25, 2010 11:34 am
Re: Reading / writing file created by C++ MFC application
thanks for the replys, really helped!
managed to get the decoding working, now im looking at the encoding side.
Getting there slowly.
I have another question. i need to encode a lat/long pair
using......................
bits-32/1 (Longitude) In WGS.84 in two’s complement.
Range -180 £ longitude < 180 deg.
(LSB) = 180/2 to the power 25 degrees
for example - i have the values 51.770302, -4.061172
am i right in thinking that revolution uses twos complement internally?, and i would be safe enough using--
put binaryEncode ("f*",(tdata[1]*128)) into theLatLong
put binaryEncode ("f*",(tdata[2]*128)) after the last item of theLatLong
managed to get the decoding working, now im looking at the encoding side.
Getting there slowly.
I have another question. i need to encode a lat/long pair
using......................
bits-32/1 (Longitude) In WGS.84 in two’s complement.
Range -180 £ longitude < 180 deg.
(LSB) = 180/2 to the power 25 degrees
for example - i have the values 51.770302, -4.061172
am i right in thinking that revolution uses twos complement internally?, and i would be safe enough using--
put binaryEncode ("f*",(tdata[1]*128)) into theLatLong
put binaryEncode ("f*",(tdata[2]*128)) after the last item of theLatLong