
- Forum
- Programming Talk
- C and C++
- What commands are available
What commands are available
This is a discussion on What commands are available within the C and C++ forums, part of the Programming Talk category; What are the commands that are available to read text files in C programming language? If someone could give me ...
-
03-01-2007, 10:14 AM #1
- Join Date
- Apr 2006
- Answers
- 124
What commands are available
What are the commands that are available to read text files in C programming language? If someone could give me the usage of these commands also I could get a detailed idea on the same.
-
Have a file pointer and open the file using fopen in read mode denoted by r+. Check and exit if file pointer is equal to NULL since it means file not found. If file pointer not equal to NULL then read the file using fgets function.
Try the above logic and let me know if you get struck. I will help you out.
-
02-28-2012, 07:41 AM #3
- Join Date
- Feb 2012
- Answers
- 66
fopen is used open a text file for reading.
The file is opened for reading. Each line is successively fetched using fgets command. The string is then converted to a long integer. fgets returns NULL when there are no more lines in the file.
-
Sponsored Ads

Reply With Quote





