Advertisement

File IO problems

Started by February 15, 2000 11:30 PM
0 comments, last by Great Milenko 24 years, 7 months ago
ok I''m trying to create a pak like file for my game. The problem lies in the fac that I wan''t to put both text and binary files in to the file. I''m having problems with having both types in the file. I''ve tried several difrent ways of geting the data in. I eather can read text right and screw up the binary or get binary right and screw up the text. here would be a sample: Text: This is a Test File Line 1 Line 2 Line 3 Comes out: This is a Test File Line 1 Line 2 Line 3ÍÍ if i use binary file io. but if I don''t use binary then bmps and the like are screwed up. heres the code: ifstream file; #ifdef USE_BINARY file.open(pfilename,ios::in/ios::binary); #else file.open(pfilename,ios::in); #endif file.read(&m_data,sizeof(m_data)); is there any easy way of doing this? </i> Great Milenko<P>Words Of Wisdom:<BR>"Never Stick A Pretzel In Your Butt It Might Break Off In There."<P><BR>http://www.crosswinds.net/~milenko<BR>http://www.crosswinds.net/~pirotech<BR>
The Great Milenko"Don't stick a pretzel up your ass, it might get stuck in there.""Computer Programming is findding the right wrench to hammer in the correct screw."
Open the file in binary mode. You can still use file.getline() to read text.

Have you read Resource files explained? I don''t remember if it covers text/binary issues but it is a tutorial on how to make .pak like files.

This topic is closed to new replies.

Advertisement