This is the code from a book.
Why while loop is used?
I think the code will be same as using without while loop.Code:while ((bytesIn = fread (rec, 1, BUF_SIZE, inFile)) > 0) { bytesOut = fwrite (rec, 1, bytesIn, outFile); if (bytesOut != bytesIn) { perror ("Fatal write error."); fclose(inFile); fclose(outFile); return 4; } }