You are here:

C/doubt in C

Advertisement


Question
basic concept of reading %26 writing characters in file using C language......
then tell the concept of fseek,ftell,rewind,etc

Answer
A file has a file pointer and, when bytes are read from a file, they are read from the position of the file pointer. Each time a byte is read, the file pointer moves to the next byte. The fseek function lets you move the file pointer forward or backward. The ftell function tells you how far the file pointer is from the start of the file. The rewind function moves the file pointer back to the start of the file. There are many functions for reading:
read
fread
fgets
fscanf

There are similarly many functions for writing:
write
fwrite
fputs
fprintf

I suggest you read about all those functions, look at code samples, and then try writing your own code. Descriptions of those functions, and code samples are all over the internet. Just search for them with google. Then, if you don't understand something, ask me a specific question. I will be happy to give you a more detailed answer if you ask a more specific question.

Kindest regards
Zlatko

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

No longer taking questions.

Experience

No longer taking questions.

Education/Credentials
No longer taking questions.

©2012 About.com, a part of The New York Times Company. All rights reserved.