Hello, I am trying to "peek" the next character to see if it is a character. If the word exceeds the max linelength it should be written in the next line with the count starting from zero again.

for example:
if the max line length is 10,

The max
length is
10.

rather than

The max le
ngth is 10

is this the correct if function?

if (current >= linelength)
		{
			char a;
			if(isalpha(infile.peek()))
			{
				outfile.put('\n');
				count = 0;
			}
			else
				outfile.put(current);
			count++;
              }

thank you!

Use

if(count >= linelength)