Clear Contents of a File

While working with file system, we may need to clear contents of a file without deleting file itself. Programming languages provides various methods to do that. A table includes a…