lines of a text file

This is a discussion on lines of a text file within the C++ Programming forums, part of the General Programming Boards category; hi, say I had a text file that was read by my program, how would I be able to get ...

lines of a text file

hi, say I had a text file that was read by my program, how would I be able to get it read each line seperately, storing each line in a seperate variable and if the line had nothing in it, the program would ignore that line. Is this possible?

Offhand, try first counting the lines (count "\n"s). Then use that count with new to create an array with size of number of lines. Read the lines into the array. Check for empty lines before reading the lines into the array, and skip those lines.
Haven't tried it, but that's an outline, anyway

You would have to use something like fgetc. Check for leading whitespace, nelwines, and end of file characters. This is getting on the edge of having to fully understand the implimentation of a string class.