|
-
May 12th, 2009, 01:58 AM
#1
Accessing external files, how?
Sorry about the nooby question, but I'm still working on that fraction calculator mentioned in the last thread, and I need to know how to do the following:
-> Make my program acess an external file
-> Check that the value of one of two variables don't match any in the external file.
Each line of the external file contains a number.
At the moment, the external file is a txt document, however it's easy enough to change.
Sorry about such a nooby question btw
Thx in advance,
-Cobrah
Last edited by Cobrah; May 12th, 2009 at 02:03 AM.
-
May 12th, 2009, 03:50 AM
#2
Re: Accessing external files, how?
Use an object of class std::ifstream to open and read the file. I'm sure you will find a class reference and examples on the net (including this forum).
More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity. --W.A.Wulf
Premature optimization is the root of all evil --Donald E. Knuth
Please read Information on posting before posting, especially the info on using [code] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|