• Advertisement
Sign in to follow this  

Load filename from a file

This topic is 4602 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im trying to load another file from reading the file name through a text file. but for some reason it doesnt work. if i do this: loadOtherFileFunction( "resources\\lvl1.nsc" ); then it works. but if i do something like this char input[80]; ifstream >> input; loadOtherFileFunction( input ); then it crashes. ive checked input, and it is the same string as before, ive tried making input a char* too and it doesnt work. when i do a comparison: if ( input == "resources\\lvl1.nsc" ) they dont come up as the same. does the comparison operator here compare memory address? either way, how can i get the dynamic input value to be the same as "resources\\lvl1.nsc" because apparently it isnt. thanks. [Edited by - Shannon Barber on July 17, 2005 11:09:21 AM]

Share this post


Link to post
Share on other sites
Advertisement
I do the same thing for a game i'm working on. However, the files are in XML format - I then use tinyxml to load and parse the files. The main advantage of this approach is that it ensures all files use a consistent and easy to use format. It also makes code reuse for a future project easy - though what you're working on may be so simple that using XML would be overkill, it's always a good idea to look toward the future.

There's a great tutorial here at gamedev about using tinyxml here.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement