



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Lecture # 1 1 File Handling Reading,fetching,getting,extracting data Data โ File (set of related records) Stream โ logical interface of file โ flow of data from source to d destination writing,storing,inserting, putting data. โ Associated (open operation) โ Not associated (close operation) Stream Types โ Text Stream (sequence of characters) โcharacter translationโe.g. new line is represented as carriage return โ Binary Stream (sequence of bytes) โ the number of bytes written or read is always the same as those on external devices/no character translation File Markers โ EOF โ start of first byte or character of file โ BOF โ end of last byte or character of file โ Newline โ ordinary file (Enter) โ in C \n is used at the end of each line File opening
โ Getc() โ reads the next character from file โ Returns EOF โ if error occurs โ To use this function file must be in open mode โ Variable=getc(file_pointer); โ variable is a character variable String Handling โ Combination of characters enclosed in double quotes โ Char (data type) name_of_string [string_length(no of characters)]; โ Also declared without specifying number of characters โ String variable โ variable used to store string โ Last character of string โ null character \0 (it is included in string) โ Char name[20]=โSTEPโ; โ Char str[ ]= โ I Love PGCโ; โ Header file โ string.h โ String functions โ fputs(), fgets(), strcpy() etc Fputs()
Fgets()