|
今天测试程序.我用如下程序测试:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int fd;
char* pszText = "this is a test, this is a test,this is a test, \
this is a test,this is a test,this is a test,this is test\r\n";
fd = open( "/home/test/test.txt", O_CREAT|O_EXCL|O_APPEND|O_RDWR);
while(1)
write(fd, pszText, strlen(pszText) );
close(fd);
return 0;
}
结果当test.txt文件超过 2,147,483,647 时报错
文件大小超出限制
我接着改用fopen,还是如此,用c++ 的ofstream, 结果都是一样阿,深受打击.
我把我的程序拿到windows下,切没有这个问题,一切很好.
担心是linux内核问题. 升级到2.6以后问题依然存在, 实在想不出为什么那,呵呵,大家帮忙 |
|