Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ANDHRA PRADESH
Name :M.Subramanyam
Designation :Senior Lecturer
Branch :Computer Engg.
Institute :Q.Q.Govt.Polytechnic,Hyderabad.
Year/Semester :III Semester
Subject :UNIX & C
Subject Code :CM-304
Topic :Files
Duration :50 Min
Sub Topic :Random access files
Teaching Aids :PPTs, Animations
CM304.89 1
Recap
CM304.89 2
Objectives
CM304.89 3
Random Access files
fseek()
rewind()
ftell()
CM304.89 5
fseek() function
CM304.89 6
fseek() function
Contd..
Symbolic_
mode Meaning
constant
Move the file pointer always
0 SEEK_SET from the beginning of the file.
Move the file pointer from the
1 SEEK_CUR current position.
Move the file pointer always
2 SEEK_END from the end of the file.
CM304.89 7
fseek() function
Contd..
CM304.89 8
Example
CM304.89 9
rewind() function
rewind():
Resets the file pointer at beginning of the file.
Syntax:
rewind(FILE *);
Example : rewind(fp)
fp-file pointer
CM304.89 10
ftell() Function
CM304.89 12
Example2
CM304.89 13
Summary
In this class, you have learnt about …
The file can be accessed randomly.
The fseek() is used to move the file pointer to desired
location.
CM304.89 14
Quiz
CM304.89 15
Quiz
CM304.89 16
Quiz
2)ftell()
a) is function
CM304.89 17
Quiz
2)ftell()
a) is function
CM304.89 18
Frequently Asked Questions
functions in files?
CM304.89 19