Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Arrays and File input

I must read two text files into memory using arrays. Then, allow a user to input a name. The porgram should search through both arrays, and, when there is a match, output the popularity and number of namings.
Like this:

Bob is ranked 1 among boys with having 7893 namings.

the text files look like: (name, blankspace, number)
Bob 7893
Jake 6567
Ken 5605
etc...

I just want to know how do I read the files into into memory using arrays?
NOTE: I must NOT use Vectors.

thanks :-)
[536 byte] By [kenjenkins] at [2007-11-11 10:25:26]
# 1 Re: Arrays and File input
char array[biggestfilesize];
ifstream inf;
inf.open("filename");
inf.read // I forget the order of the parameters here... look in your help.
// seek end of file and tell to get the filesize or use a CFile(microsoft) or other extension to get this info. look up the members of ifstream to get parameters etc on that.

done, its in a char array. Probably not what they wanted, but it will do the job and its short. What is probably desired is to iterate and read one item at a time into an array.
jonnin at 2007-11-11 20:58:52 >
# 2 Re: Arrays and File input
I figured out my problems. My program is good now. Thanks for the help!

:-)
kenjenkins at 2007-11-11 20:59:53 >