Jump to content
  • Advertisement
Sign in to follow this  
Kryptus

Loading a text file using stdio.h

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

How do I load and save a text file using the stdio.h libary? I found a few tutorials on using fstream but I'd rather use stdio first.

Share this post


Link to post
Share on other sites
Advertisement
You are using pure C?
IF so,you may do like this:

#include<stdio.h>

int main()
{
FILE *fptr;
if((fptr=fopen("textfile.txt","rb+"))==NULL)
{
printf("An error occured");
return 1;
}
/*Your code here*/
fclose(fptr);
return 0;
}

Share this post


Link to post
Share on other sites
I found more code samples for stdio.h out there, so I thought if I could learn it, then I would be able to understand it better, before moving onto fstream.

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!