#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
int main(int argc, const char* argv[])
{
if(argc < 3)
{
fprintf(stderr, "%s <filename> <size>\n", argv[0]);
exit(1);
}
long int len = strtol(argv[2], NULL, 10);
int new_len = truncate(argv[1], len);
if(new_len == -1)
{
perror("truncate");
exit(1);
}
return 0;
}
Linux下C中trunc函数
猜你喜欢
转载自blog.csdn.net/zxy131072/article/details/108534234
今日推荐
周排行