Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(11) Why do you have to call fclose()? (12) Why do you have to call FindClose()?

ID: 3874552 • Letter: #

Question

(11) Why do you have to call fclose()?
(12) Why do you have to call FindClose()?
(13) If you try to read 1000 bytes from a file using fread() but the file only contains 100 bytes, describe what will happen with the fread() call.
(14) If you use fread to read 100 bytes at a time from a file that contains 1000 bytes, how many calls to fread would it take before you could tell that you were at the end of the file?
(15) What is the difference between a text file and a binary file?
(16) What function would you likely use to read from a binary file? What function would you likely use to read from a text file?
(17) If you use fgets() to read a line in from a text file and the input does not have a ' ' in it, what do you know about the input that the user has entered?
(18) If you have 10 lines of text in a text file, how many '' characters would you likely find contained within the contents of the file?
(19) Why is the answer not 10? (Hint: the answer isn't 9 or 11, either.)
(20) Write a line of code that uses calloc() to allocate a block that can contain an array of 10 struct Parts. Assume that you have a variable called pBlock that is declared appropriately.
(21) Declare the pBlock variable from the previous question.
(22) Describe the criteria for how to split up a 100,000 line program into multiple files?
(23) Describe how the bitwise-AND operator can be used to determine if a file has a particular attribute.

Explanation / Answer

11)

fclose()

fclose() function is used to close file which is already opened by fopen();

Syntax:

//FILE which is file datatype

FILE *fc;

fclose(fc); // in C,c++ language

another method

fclose(FILE *fc) ;

15)

Binary File contains a information in

binary format (0's and 1's)

Text files need interpreter to transform the text file into machine understandable form.

16)

you can use fread() function to read both text file and binary file

BINARY FILE TEXT FILE

Binary File contains a information in

binary format (0's and 1's)

TEXT File contains information in text format Binary files are easily understandable by the Machine

Text files need interpreter to transform the text file into machine understandable form.

Binary files can contains all informations such as Text,image,videos etc.. Text files only contains the Textable format.