Review C language-File Operations
# Include
# Include
Int main () {char buf [64] = "hello word! "; // Open the FILE to read the FILE information. Output/* FILE * fp = fopen ("./file1 "," r "); if (! Fp) {perror ("An error occurred while opening the file! "); Exit (-1);} // char buf [64] = {''}; size_t num = fread (buf, fp ); printf ("% d % s \ n", num, buf); fclose (fp); * // Write FILE Information/* FILE * fp2 = fopen (". /file1 "," w "); if (! Fp2) {perror ("An error occurred while opening the file! "); Exit (-1);} // char buf [64] =" hello world "; fwrite (buf, 1, 64, fp2); fclose (fp2 ); * /// read the content in FILE 1 to FILE * fp3 = fopen (". /file1 "," r "); if (! Fp3) {perror ("An error occurred while reading the file! "); Exit (-1);} FILE * fp4 = fopen ("./file2 "," w "); if (! Fp4) {perror ("An error occurred while reading the file! "); Exit (-1);} while (1) {size_t num = fread (buf, 1, 20, fp3); if (num <= 0) {break ;} fwrite (buf, 1, num, fp4);} fclose (fp3); fclose (fp4); return 0 ;}