Jump to content
  • Advertisement
Sign in to follow this  
Ben Greenwood

ifstream and Half-Life

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

Hi, I'm not sure if anyone will know this because it's a pretty old game, but anyway, I have a question about coding for Half-Life 1. Basically, if I make a dll that modifies the game, and then use something like: ifstream file_in("readme.txt"); I can read from readme.txt, provided it is in the Half-Life directory. But say I put readme.txt in a sub-directory called "game". Now, if I try the following, it won't work: ifstream file_in("/game/readme.txt"); Anyone know how to code it so that I can read from readme.txt when it's in a subdirectory? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
ifstream file_in("/game/readme.txt");

will read from the current drive directory "/game", not a subdirectory of the current working directory.

Try:

ifstream file_in("./game/readme.txt");

The period says "start in the current working directory."

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!