I want to know whether size of text or binary file can be reduced without creating temporary file. So that we can delete the data present at very end of file.
If yes then how. If no then why.
Yes, you can reduce file size using truncate()
or ftruncate()
functions that are available on POSIX systems.
For Windows, use SetFilePointer
to set the current position to desired file size, then call SetEndOfFile
to actually truncate it.