written 8.5 years ago by | • modified 8.5 years ago |
Mumbai University > COMPS > Sem 3 > Data Structures
Marks: 5 M
Year: May 2015
written 8.5 years ago by | • modified 8.5 years ago |
Mumbai University > COMPS > Sem 3 > Data Structures
Marks: 5 M
Year: May 2015
written 8.5 years ago by |
The various file handling operations in c are:
a. fopen(): This command is used to open a particular file. The Syntax for it is:
File *fptr;
Fptr=fopen(“filename”,”mode”);
Here fptr is a pointer to the file
Here filename is name of file and mode can be the mode of opening like
write(w), read(r), append(a).
b. fclose(fptr): This command is used to close a file.
c. getc (): Used to read from the file.(SingleCharacter)
d. putc(): Used to write into the file. (SingleCharacter)
e. fprinf(): write multiple data to file.
f. fscanf(): read multiple data from file.
g. fputs(): write a string into file.
h. fgets(): read string from file.
i. ftell(fptr): returns the current position of file pointer.