Posted by Tyler Woods on March 18, 2001 at 17:31:47:
In Reply to: How do we determine array size? posted by Aaron Faust on March 14, 2001 at 00:11:16:
: Ok, so the array is to be 1.25 times bigger than the number of entries in the file. Is there a "nice" way to determine how many entries are in the file - the only way I can figure is to go entirely through each file once just counting lines, then open the same file again to actually load the entries into the newly created array of the size that was just determined. Since we can't resize our array dynamically, this seems like the only alternative, but it also seems a bit cheesy. Am I missing something?
Could we just do a quick file parsing and count how many 'endl' are in the fil or will there be comments or duplicate file names or anything like that?
Post a Followup