网站首页  词典首页

请输入您要查询的函数:

 

术语 setendoffile
释义 SetEndOfFile
语法:
C++
BOOL WINAPI SetEndOfFile(
__in HANDLE hFile
);
SetEndOfFile函数
设置指定文件的文件指针当前位置的物理文件的大小。
物理文件的大小,也称为文件的末尾。该SetEndOfFile函数可用于截断或扩展文件。要设置文件的逻辑结果,使用SetFileValidData功能。
参数
hFile [in]
一个句柄,文件会延长或截断。
文件句柄必须创建与GENERIC_WRITE访问权限。有关更多信息,请参阅文件安全性和访问权限。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零(0)。为了获得更多错误信息,调用GetLastError。
备注
该SetEndOfFile函数可用于截断或扩展文件。如果该文件的延长,之间的文件的旧的结束和新的档案文件的末尾的内容没有定义。
每个文件流有以下内容:
文件大小:在一个文件中的数据大小,字节。
分配大小:该是一个磁盘上,这总是一个甚至多个文件簇大小分配的空间大小。
有效数据长度:在一个实际写入文件中的数据长度,字节。此值总是小于或等于文件的大小。
该SetEndOfFile函数设置文件的大小。使用SetFileValidData设置有效数据的长度。
如果CreateFileMapping被称为创造一个hFile文件映射对象,调用UnmapViewOfFile必须首先取消映射的所有意见,并呼吁CloseHandle关闭文件映射对象,然后才能调用SetEndOfFile。
交易业务
如果有一定的处理,那么在年终改变交易文件中的位置是交易。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinBase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
CloseHandle
CreateFile
CreateFileMapping
文件管理函数
SetFileInformationByHandle
SetFileValidData
UnmapViewOfFile
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年9月3日
==英文原文==SetEndOfFile Function
Sets the physical file size for the specified file to the current position of the file pointer.
The physical file size is also referred to as the end of the file. The SetEndOfFile function can be used to truncate or extend a file. To set the logical end of a file, use the SetFileValidData function.
Syntax
C++
BOOL WINAPI SetEndOfFile(
__in HANDLE hFile
);
Parameters
hFile [in]
A handle to the file to be extended or truncated.
The file handle must be created with the GENERIC_WRITE access right. For more information, see File Security and Access Rights .
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero (0). To get extended error information, call GetLastError .
Remarks
The SetEndOfFile function can be used to truncate or extend a file. If the file is extended, the contents of the file between the old end of the file and the new end of the file are not defined.
Each file stream has the following:
File size: the size of the data in a file, to the byte.
Allocation size: the size of the space that is allocated for a file on a disk, which is always an even multiple of the cluster size.
Valid data length: the length of the data in a file that is actually written, to the byte. This value is always less than or equal to the file size.
The SetEndOfFile function sets the file size. Use SetFileValidData to set the valid data length.
If CreateFileMapping is called to create a file mapping object for hFile, UnmapViewOfFile must be called first to unmap all views and call CloseHandle to close the file mapping object before you can call SetEndOfFile.
Transacted Operations
If there is a transaction bound to the handle, then the change in the end-of-file position is transacted.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
CloseHandle
CreateFile
CreateFileMapping
File Management Functions
SetFileInformationByHandle
SetFileValidData
UnmapViewOfFile
Send comments about this topic to Microsoft
Build date: 9/3/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa365531(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:20:00