Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
write function,
 indicates the number of characters of the longest line in one text file

thank you very much !!!
Posted
Updated 5-Oct-12 23:02pm
v2

Hi,

It seems like homework,

I will not give you exact program but i will guide you.

You need to read each line and count the characters, you can store hightest charecter count in one variable. If next read gives you greater characters then previously stored character then replace it with new line character count. this way complete the process for all the line.

Finally after reading all the line you have maximum character count in your variable.

Hope it helps you,
Best luck
 
Share this answer
 
Comments
nam giang 5-Oct-12 21:50pm    
thank you very much ^^
AmitGajjar 5-Oct-12 22:07pm    
Your welcome
You can do this by reading and counting number of character in the each line.take one variable let say charcount for character count intiate it to 0 and then updates its value to current line character count if its character count is greater than current charcount variable value otherwise keep it as it is.By this way you can get max char count line.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900