
- Forum
- Programming Talk
- C and C++
- C file handling
C file handling
This is a discussion on C file handling within the C and C++ forums, part of the Programming Talk category; hey folks..... m still an amateur in this part of d world n m dying get this code cracked. Hv ...
-
C file handling
hey folks..... m still an amateur in this part of d world n m dying get this code cracked.
Hv got this program which asks me to print certain data on the screen , for a specified no. of times , by taking the input from a file named input.txt. Can nebody pls explain it to me how I can read the input from d text file n dependin on d i/p , print out d msg on d monitor.
-
So are you writing a program or do you have an existing program? If you are writing the program, look at the fread, fscanf, and fprint functions. If you have an existing program, then make sure you have the input.txt file with the appropriate data.
-
At first u should open the input.txt file in ur program.
FILE *file;
file = open("input.txt","r");
then u can use fscanf() function in several times and print the data into the console.
and also close the file by this command
fclose(file);
-
If you could place the code you have written or on which you have query I can help you out by seeing the code and correct the code and give you for you to use.
-
Sponsored Ads

Reply With Quote





