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 ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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); |
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to open image file in c | vijaykumarreddy | C and C++ | 4 | 07-30-2008 06:35 AM |
| strange result when read from different file | hat123 | C and C++ | 3 | 07-06-2006 06:06 PM |
| C Programming - File management in C | lokeshm | C and C++ | 1 | 06-17-2006 08:21 PM |
| how to write into notepad file through winrunner? | mangalsachin2002 | Testing Tutorials | 2 | 04-03-2005 02:39 PM |
| ClassNotFoundExceptions after Installing EAR file | akpraveen | Java Tutorials | 3 | 07-20-2004 08:51 PM |