Jump to content
  • Advertisement
Sign in to follow this  
t5hoo6

Need help in C\C++

This topic is 4775 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 am tring to read a file off the internet in C\C++ here is an example it is not on the internet yet though. HTTP://WWW.OFFICIALMKDVD.COM/BTH/DATA001.DAT data001.dat only has 6 lines of info but I can't fond out how to open the file, it is for a single player online game. I would make it multiplayer, but I don't know how. I think I can open the file with this part of my code: fopen("HTTP://WWW.OFFICIALMKDVD.COM/BYH/DATA001.DAT", "RT"); and is there a way to read a full line of data? thanks in advance, THOOVER

Share this post


Link to post
Share on other sites
Advertisement
fopen() only works for file names, not URLs. You need to either use a HTTP library to download files from the net, or write the socket code yourself.

Share this post


Link to post
Share on other sites
ok since the files are only 5 to 125KB I will make it download the file but I still need to know how to read full lines of info and also can you use #define in midle of a void?????

Share this post


Link to post
Share on other sites
Quote:
Original post by t5hoo6
I still need to know how to read full lines of info


You mean you want to read one line at a time? You can do that with some pointer arithmetic and the strstr function.

Quote:
Original post by t5hoo6
can you use #define in midle of a void?????


Can you show an example of what you want to do?

Matt Hughson

Share this post


Link to post
Share on other sites
here is my example of data

printf("hello");

here is what i want to do

read that line as LIN

and

#define code LIN

Share this post


Link to post
Share on other sites
hey dude, the only helpful advice that we can give you at this point is what books to read. You need to get an understanding of the basics first before you try doing something ambitious. For one thing, forget that defines even exist. I have thousands and thousands of lines of code in my project and not a single define. I recommend buying "Accelerated C++" It will get you doing some cool stuff and even better you will understand what you are doing.

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!