Linux ftruncate函数
2013-06-23 23:23
183 查看
NAME truncate, ftruncate - truncate a file to a specified length SYNOPSIS #include <unistd.h> #include <sys/types.h> int truncate(const char *path, off_t length); int ftruncate(int fd, off_t length); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): truncate(): _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L ftruncate(): _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED || /* Since glibc 2.3.5: */ _POSIX_C_SOURCE >= 200112L DESCRIPTION The truncate() and ftruncate() functions cause the regular file named by path or referenced by fd to be truncated to a size of precisely length bytes. If the file previously was larger than this size, the extra data is lost. If the file previously was shorter, it is extended, and the extended part reads as null bytes ('\0'). The file offset is not changed.
相关文章推荐
- linux中fileno函数与ftruncate函数解析
- Linux 时间 函数
- linux中的fork()函数以及标准I/O缓冲
- linux netfilter框架中比较重要的结构体和函数
- python os.system(command)函数的返回值 与 linux命令返回值的关系
- linux网络编程之socket(十):shutdown 与 close 函数 的区别
- python linux下IP操作函数
- linux中fork()函数详解
- linux几种定时函数的使用
- linux 函数库之 times
- C字符串处理函数的实现(Linux)
- fork()函数与Linux中的多线程编程
- 浅谈linux几种定时函数的使用
- linux的初始化函数(late_initcall和module_init)
- Linux 文件I/O(二)之 fcntl函数讲解
- Linux C——带IO缓冲的文件操作函数
- Linux 进程学习(四)------ sigaction 函数
- linux 时间函数解释
- Linux 时间获取函数-C语言
- 杂记之毕业设计之linux下精确定时函数