|
-
March 31st, 2008, 01:59 PM
#4
Re: Help i need some tips
 Originally Posted by hrstar24
I specifically need help on being able to read in the data files, which will contain like a name, then the value there. What functions should i use to read in this data and store it into an array?
To read in you use operator>>. Some code snipplet:
Code:
std::ifstream f("filename.txt");
std::string s;
float n;
while (f >> s >> n) {
// form a struct out of s and n and store it in the array
}
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
|