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.
fread (& name_of_structure, size_of_(structure name), l, file pointer); e.g.,
char nm; /* 20 bytes */
int age; /* 2 bytes */
struct employee Emp;
fread (&Emp, size of (Emp), 1, fp);
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.
fwrite (& struct—name, size of (struct), 1, fp); e.g.,
char city ; /* 30 bytes */
long in pin; /* 2 bytes */
char country ; /* 20 bytes */
struct address add;
fwrite (& add, size of (add), 1, fp);