I've read the tutorial on this site, but I am not quite sure what is means. Ex. Say if I make a Readme type file or help file in notepad, could I implement that into my program. Is that what file i/o is used for? Not sure what it means.
I've read the tutorial on this site, but I am not quite sure what is means. Ex. Say if I make a Readme type file or help file in notepad, could I implement that into my program. Is that what file i/o is used for? Not sure what it means.
Videogame Memories!
A site dedicated to keeping videogame memories alive!
http://www.videogamememories.com/
Share your experiences with us now!
"We will game forever!"
It means like instead of printing to cout (stdout, the screen) you can print to a file; and instead of using stdin (cin) you can read from a file.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
OH, ok. I was way off. Thanks for the reply.
Videogame Memories!
A site dedicated to keeping videogame memories alive!
http://www.videogamememories.com/
Share your experiences with us now!
"We will game forever!"
think of it this way: how does a store save information about their sales for the day when they shut the computers off? how does a game know where you left off when you exit?
basically, you can write information to a file to save it for later, or you can give it a file to parse data from, or a whole bunch of things... sure stores use databases, but it's (very) vaguely the same idea...
for example:Code:#include<iostream> #include<fstream> int main() { int num; std::cout<<"What do you want to do:\n" <<" 1. Save a number\n" <<" 2. Retrieve the number\n"; std::cin>>num; std::cin.ignore(1); if(num==1) { std::cout<<"Enter the number: "; std::cin>>num; std::cin.ignore(1); std::ofstream file("test.in",std::ios::trunc); file<<num; file.close(); } else if(num==2) { std::ifstream file("test.in"); if(!file) { std::cerr<<"File not available, exiting\n"; exit(1); } file>>num; file.close(); std::cout<<"The last number was: "<<num<<std::endl; } else { std::cerr<<"Invalid option, exiting\n"; exit(2); } }
Join is in our Unofficial Cprog IRC channel
Server: irc.phoenixradio.org
Channel: #Tech
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
52 Members so far, are YOU a member?
Current team score: 1223226 (ranked 374 of 45152)
The CBoard team is doing better than 99.16% of the other teams
Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)
Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT
[qoute]
I've read the tutorial on this site, but I am not quite sure what is means. Ex. Say if I make a Readme type file or help file in notepad, could I implement that into my program. Is that what file i/o is used for? Not sure what it means.
[/qoute]
Yes you can; in the sense that mutiple programs with the same 'readme' content can print it on to the screen. reducing the overall size.
but this is only a very small advantage:
(read the previous post; by major_small);