Sign in to follow this  
xSKOTTIEx

Load filename from a file

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this