Home > Back-end > File truncation application scenario is what? Why we need to implement a truncated?
File truncation application scenario is what? Why we need to implement a truncated?
Time:11-25
I am learning embedded driver, feel a little idle, so I looked at some user space such as c + + programming method, less programming experience, see file truncation, a little confused the use scenarios, is to save space?
CodePudding user response:
I don't know you say what is truncated from interception want part of the file
CodePudding user response:
SetEndOfFile The SetEndOfFile function moves The end - of - file (EOF) position for The specified file to The current position of The file pointer.
BOOL SetEndOfFile ( HANDLE the hFile//HANDLE of the file whose EOF is to be set );
The Parameters HFile Handle to the file and its EOF position version. The file Handle must have had been created with GENERIC_WRITE access to the file. The Return Values If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Few This function can be 2 truncate or extend a file. If the file is extended, the contents of the file between the old EOF the position and the new position are not defined.
If you called CreateFileMapping to create a file - mapping object for hFile, you must first call UnmapViewOfFile to unmap all views and call the CloseHandle to close the file - mapping object before you can call SetEndOfFile.
QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: the Requires version 1.0 or later. Header: Declared in winbase. H. The Import Library: Use kernel32. Lib.
See Also The File I/O the Overview, the File Functions provides, CloseHandle, CreateFile, CreateFileMapping, UnmapViewOfFile