Hi. Another newbie here looking for some insight.
I have a menu drivin program with 5 functions. got first 3 down and the 4th wants me to read a plain text fil and output the length of the longest line.
I know as far as getline(infile,str). where str is just the generic variable for my string. but how to i count how many characters are in said string.
I have this so far. i know its far off, but hey i gotta start somewhere.
//priming read
getline(infile,str);
//letter count loop
while (!infile.eof())
{
if ()
count++;
getline(infile,str); //reset
while (letter == '\n' ) //when letter is at a new line do this
{
if (totalcount <= count)
{
totalcount = count;
}
}
havent really gotten much into string. so im not sure if str.size() if off limits.