If you want to read exactly one byte of a file. Which of the following functions will you use to accomplish the task?
Each correct answer represents a complete solution. Choose two.
[1380,1381]
Correct:
--> fread($fp,1)
--> fgetc($fp)
Explanation:
Answer options A and B are correct.
If you want to read only one byte of a file, you need to use either fread() or fgetc() function. fread() function reads up to length bytes from the file pointer. The fgetc() function gets a character from the given file pointer.
Answer options C and D are incorrect. The fgets() and fgetss() functions will return the string up to length -1 bytes (means 1-1 = 0 bytes).