I was able to sort through a right old messy .x file using the following code. I put a string at the end of the file of a type not likely to be found anywhere else in it. I used ^_^ and the code sorted through it all and produced a very neat human readable version text file output. The source file data looked something akin to a tiger's stripes beforehand it was all over the place as the endl command hadn't been used to create it.
All very good and all, now I can much more easily read the source format of any .x files my modelling programs output.
using namespace std;
int main ()
//declare an instance of ofstream
while (line != "^_^")
cout << line << endl;
oStream << line << endl;
However, a .p3d file is a different ball game (ODOL 7 and 40 - they're in binary). What I want to know is, instead of using strings can I read individual bytes and output them as ASCII type characters (chars basically)? That way I could loop through an entire .p3d file and output it's source to a text file where it could be read. I would need to read individual bytes and also be able to issue an std::endl instruction when encountering a carriage return or tab.
Can anyone help? I don't know how to do this or even if I can use formatted I/O through <iostream> to do it? Thanks