How to use functions fseek(), freed(), fwrite() and ftell()?

How to use functions fseek(), freed(), fwrite() and ftell()?

We can use fseek(),fread(),fwrite() and ftell() functions like that,

fseek(f,1,item)->Move the pointer for file f a distance 1 byte from location item.

fread(s,item1,item2,f)->Enter item2 data items,each of size item1 bytes,from file f to string s.

fwrite(s,item1,item2,f)->send item2  data items,each of size item1 bytes from string s to file f.

ftell(f)->Return the current pointer position within file f.
Functions fread,fseek and fwrite returned type is int and ftell is long int.

By:Vivek Kr. Agarwal
Date:2006-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related C Subjective Links

C Subjective interview questions and answers for experienced and fresher