C/doubt in C
Expert: Zlatko - 7/10/2010
Questionbasic concept of reading %26 writing characters in file using C language......
then tell the concept of fseek,ftell,rewind,etc
AnswerA 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