Jump to content
  • Advertisement
Sign in to follow this  
gellin

reading from a text file

This topic is 4573 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

I want to read in character by character from a text file. Now I've done this plenty of times before and know the basics of it but here's the catch. I want to add it to my solution so it compiles with my project. That way no one can see what was in the original file. I just can't think of a good way to read from the file when it's already in there.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by gellin
I want to read in character by character from a text file. Now I've done this plenty of times before and know the basics of it but here's the catch. I want to add it to my solution so it compiles with my project. That way no one can see what was in the original file. I just can't think of a good way to read from the file when it's already in there.


So you mean you want to add the text file to your project and embed it into a C (or whatever languege) source file so it gets embedded into the application?

If that's what you want, you're going to have to convert your text file into source code and use the text to initialize a string (C string, std::string, Java.string, BSS region, /common/ block, whatever your language is).

Share this post


Link to post
Share on other sites
Quote:
Original post by Bregma
So you mean you want to add the text file to your project and embed it into a C (or whatever languege) source file so it gets embedded into the application?

If that's what you want, you're going to have to convert your text file into source code and use the text to initialize a string (C string, std::string, Java.string, BSS region, /common/ block, whatever your language is).


Yes I want to embed it. I was just hoping there was some way to still read it in like a normal text file without have to convert the file into a string beforehand.

Share this post


Link to post
Share on other sites
Quote:
Original post by gellin
[...]That way no one can see what was in the original file. [...]


Do You know that it's possible to read ressources in executables ?

Share this post


Link to post
Share on other sites
If you're using C++ you can use a stringstream and just read like a file from that, but there's not really a lot of point. What has the text file got in it anyway? Anybody with a hex editor will probably be able to dig it out of the EXE without even really knowing the binary format.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!