当前位置: 技术问答>linux和unix
mmap内存映射函数报错,no such device
来源: 互联网 发布时间:2017-02-24
本文导语: char *start; char *end; sockfd=socket(AF_INET,SOCK_STREAM,0); address.sin_family=AF_INET; address.sin_addr.s_addr=inet_addr("127.0.0.1"); address.sin_port=htons(7999); len=sizeof(address); result=connect(sockfd,(struct...
char *start;
char *end;
sockfd=socket(AF_INET,SOCK_STREAM,0);
address.sin_family=AF_INET;
address.sin_addr.s_addr=inet_addr("127.0.0.1");
address.sin_port=htons(7999);
len=sizeof(address);
result=connect(sockfd,(struct sockaddr *)&address,len);
if((fd = open("1.zip",O_WRONLY|O_CREAT)) == -1) {
printf("Open 1.zip error:%sn",strerror(errno));
exit(EXIT_FAILURE);
}
if(-1==(truncate("1.zip",size))) {
printf("truncate errorn");
exit(EXIT_FAILURE);
}
number=size/4096;
for(i=1;i
char *end;
sockfd=socket(AF_INET,SOCK_STREAM,0);
address.sin_family=AF_INET;
address.sin_addr.s_addr=inet_addr("127.0.0.1");
address.sin_port=htons(7999);
len=sizeof(address);
result=connect(sockfd,(struct sockaddr *)&address,len);
if((fd = open("1.zip",O_WRONLY|O_CREAT)) == -1) {
printf("Open 1.zip error:%sn",strerror(errno));
exit(EXIT_FAILURE);
}
if(-1==(truncate("1.zip",size))) {
printf("truncate errorn");
exit(EXIT_FAILURE);
}
number=size/4096;
for(i=1;i