我写了一个双机传输程序。里面有段代码是这样的 Server: ........ off_t curoff, *datbufp; char datbuf[BUFSIZE * 4 + sizeof(off_t)]; char *iovbufp; ......... iovbufp = &datbuf[sizeof(off_t)]; curoff = lseek(fd, 0L, SEEK_CUR); readn = read(fd, iovbufp, jobsize.ps_end - curoff); *(off_t *)datbuf = curoff; if((writen = send(sockfd, datbuf, rea...
by It'sGifted - C/C++ - 2008-04-06 11:01:14 阅读(1003) 回复(1)
[quote][test:/home/test/src/temp]ls -l myfile -rwx---r-x 1 test users 2147483647 Nov 25 10:30 myfile [test:/home/test/src/temp]du -sh myfile 12K myfile[/quote] 为什么只有12K亚?程序是: [code] if (lseek(fd,(off_t)((unsigned long)(1<<31)-2),SEEK_SET) == -1) { fprintf(stdout, "lseek error: %s\n", strerror(errno)); exit(-1); } if ( write(fd, "a", 1) != 1) ...
[code]
#include
#include
为什么我的lseek老是出错?请高手指点,谢谢!
错误提示:Invalid argument
代码如下:
#include
#include
int fd; offset_t offset; fd=open("/dev/dsk/c0t1d0s7",O_RDONLY); offset=0x7fffffff+(offset_t)1; lseek64(fd,offset,0); error messages: lseek error, invalid argument. errno:22 if change /dev/dsk/c0t1d0s7 with a large file name(>;2g), it works. how to fix it?