Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.
c++ read file into array
Name: awires Date: March 23, 2004 at 01:05:57 Pacific OS: windows xp CPU/Ram: p4 2.8 ghz/512
Comment:
Im trying to read a file containing numbers. ex: 1 2 3 4 5
i open the file. make sure its opened properly and try to read the data into an array with code:
void clsArray::read_ary() { int temp;
Randoms >> temp;
while ((!Randoms.eof()) && intCount < MAX) {intArray[intCount] = temp; cout << intArray[intCount] << " "; intCount++; Randoms >> temp; } } the file is opened in the constructor and called Randoms. When the program initializes it prints out 0. as if the file is eof after the first time through the while loop. any ideas why?
Summary: Hi Guys, Can someone give me a simple example of how to read a file of userids and passwords such as a file called passwords containing: a001mm password1 cd98fk outwilldo lmn99p abc123456 into an arr...
Summary: How do I open a file and read data into an array i have a file named wordfind.in this is what my file looks like below. I am attempting to read in the information in the fist paragraph into a 2 demin...