| 1. |
Explain fread () and fwrite () functions. |
|
Answer» fread( ): This function reads a specified number of equalsized data items from an input stream into a block, fread returns the number of items (not bytes) actually read on success. Syntax: fread (& name_of_structure, size_of_(structure name), l, file pointer); e.g., struct employee Here, the fread function can read 22 bytes of information from the file pointed by file pointer fp. fwrite( ): This function appends a specified number of equal-sized data items to an output file. Syntax: fwrite (& struct—name, size of (struct), 1, fp); e.g., street address |
|