70,023
社区成员




//1.txt文件大小为1444byte
//windows :
#include <io.h>
//linux #include <unistd.h>
#include <fcntl.h>
/*#include <stdio.h>*/
int main(void)
{
// FILE * file = fopen("f:/temp/1.txt", "rb");
int fd = 0;
char buff[1024];
int reads = 0;
int counts = 0;
// fd = file->_file;
fd = _open("f:/temp/1.txt", O_RDONLY, 0777);
while ((reads = _read(fd, buff, sizeof(buff))) > 0) {
counts += reads;
}
reads += 0;
return 0;
}
//xp3下vs2008,counts 为1408, ubuntu 12.04下gcc,counts为1444
// #include <io.h>
// #include <fcntl.h>
#include <stdio.h>
int main(void)
{
FILE * file = fopen("f:/temp/1.txt", "rb");
int fd = 0;
char buff[1024];
int reads = 0;
int counts = 0;
fd = file->_file;
// fd = _open("f:/temp/1.txt", O_RDONLY, 0777);
while ((reads = _read(fd, buff, sizeof(buff))) > 0) {
counts += reads;
}
reads += 0;
return 0;
}
//xp3下vs2008,counts 为1444