Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I write a code in C to check in my file contains only 3 lines of text?

Eg
C++
9820 sads
88182c 9 298 2
88812cec 9 2 88 828 


If there are less or more than 3 lines writen in my txt file called test.txt then the program will return an error message and will exit.
Posted
Comments
PIEBALDconsult 21-Nov-14 8:15am    
Number of LINEFEEDs + 1

1 solution

Refer:
1. c retrieving total line numbers in a file[^]
2. use
exit(0)

to exit a program, need to include
#include <stdlib.h>
 
Share this answer
 
v3

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