1.

Which of the following system call is used for truncating a file?(a) truncate(b) ftruncate(c) trunk(d) truncate and ftruncateI had been asked this question by my school principal while I was bunking the class.My question is taken from System Calls Basics topic in portion System Programming I – Files of Unix

Answer»

Right choice is (d) truncate and ftruncate

The BEST I can explain: The truncate and ftruncate calls can truncate a FILE to any LENGTH. These calls are often used in COMBINATION with lseek to overwrite a certain segment of a file.



Discussion

No Comment Found

Related InterviewSolutions