FILES
FILE--> STORAGE PLACE TO STORE SOME DATA IN THE COMPUTER
File is collection of data stored in a computer
2 types of files
text file --->ASCII FILE --> Text file contains ascii values of digits,
symbols ,characters
binary file ---> 0's and 1's
FILE OPERATIONS
Closing a file
opening a file
reading data from a file
writing data to the file
FILE *ptr;
*fptr=fopen( " file.txt " ," mode " );
FILE MODES
r ---------> read mode
w----------> write mode
a ---------> append mode
r+ --------> read+write
w+ ------> write +read
a+ ------> append + read
...............................................
FILE HANDLING FUNCTIONS
fopen() --> to open a file
fclose() ----> to close a file
getc() -------> reading a character from a file
getw() -----> read integer from a file
fprintf() ---> prints or writes data to a file
fscanf()----> scan data from the file
putc ()---> to write a character to a file
putw()---->to write a integer to a file
EOF----> end of the file
...................................................................................
...................................................................................
.
main()
{
FILE *fp;
char ch ;
fp=fopen("abc.txt ", "w");
printf("enter data ");
while(ch!=EOF )
{
ch=getchar();
putc(ch,fp);
}
fclose(fp);
}