File Handling: Dr. Mayank Swarnkar
File Handling: Dr. Mayank Swarnkar
Week-13
FILE *fp;
fp = fopen("filename", "mode");
Mode Meaning
r read only
w write only
a append
r+ Existing file opened for reading and writing
w+ Same as w except both for reading and writing
r+ Same as a except both for reading and writing
Table: Modes of operation
End of File
Similar to End of String
Keyword: EOF
Usually used to check anything till end of file
Read a given file and find the number of vowels and consonants in
that file. Save this information in another file in the following format:
Vowels: Count of vowels
Consonants: Count of consonants
if(ferror(fp) != 0)
printf("Error occured \n");