请输入您要查询的百科知识:

 

词条 chsize
释义

函数名: chsize

功 能: 改变文件大小

用 法: int chsize(int handle, long size);

说 明:handle表示文件句柄,size表示要设置的大小,返回值为执行该函数后文件的大小,正常情况应该等于size

程序例:

#include

#include

#include

int main(void)

{

int handle;

char buf[11] = "0123456789";

/* create text file containing 10 bytes */

handle = open("DUMMY.FIL", O_CREAT);

write(handle, buf, strlen(buf));

/* truncate the file to 5 bytes in size */

chsize(handle, 5);

/* close the file */

close(handle);

return 0;

}

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/1 13:26:26