3.2
来源:互联网 发布:淘宝试用协议在pc端哪 编辑:程序博客网 时间:2024/04/28 10:16
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<errno.h>
#define BUFFER_SIZE 1024
int main()
{
int aim_fd;
int i;
int bytes_write,bytes_read;
// char buffer[BUFFER_SIZE];
char str[]="hello";
char *ptr;/*,*stp=str*/
ptr=str;
if(aim_fd=(open("hello.txt",O_WRONLY|O_CREAT,0644))==-1)
{
perror("open error!");
exit(-1);
}
for(i=0;i<3;i++)
{
while(bytes_write=write(aim_fd,ptr,5))
{
if((bytes_write==-1)&&(errno!=EINTR))
break;
else if(bytes_write>0)
{
ptr+=bytes_write;
}
}
}
/* while(bytes_read==read(aim_fd,buffer,BUFFER_SIZE))
{
if((bytes_read==-1)&&(errno!=EINTR))
break;
else if(bytes_read>0)
{
}
}
printf("%s",buffer);*/
close(aim_fd);
}
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<errno.h>
#define BUFFER_SIZE 1024
int main()
{
int aim_fd;
int i;
int bytes_write,bytes_read;
// char buffer[BUFFER_SIZE];
char str[]="hello";
char *ptr;/*,*stp=str*/
ptr=str;
if(aim_fd=(open("hello.txt",O_WRONLY|O_CREAT,0644))==-1)
{
perror("open error!");
exit(-1);
}
for(i=0;i<3;i++)
{
while(bytes_write=write(aim_fd,ptr,5))
{
if((bytes_write==-1)&&(errno!=EINTR))
break;
else if(bytes_write>0)
{
ptr+=bytes_write;
}
}
}
/* while(bytes_read==read(aim_fd,buffer,BUFFER_SIZE))
{
if((bytes_read==-1)&&(errno!=EINTR))
break;
else if(bytes_read>0)
{
}
}
printf("%s",buffer);*/
close(aim_fd);
}
0 0
- 3.2
- 3.2
- 3.2
- 3.2
- 3.2
- 3.2
- 3.2
- 3.2
- 3.2
- 3.2
- javacc-3.2
- javacc-3.2
- Eclipse 3.2
- 3.2 t
- 3.2.2
- usaco4.3.2
- hdu1.3.2
- bash 3.2
- 从零移植uboot 2017 到nuc970(第四天)
- RocketMQ源码分析----消费消息
- Spring AOP 处理通知中的参数【Spring 入门】
- BZOJ 2243(树链剖分+线段树 解法)
- Popularity-aware spatial keyword search on activity trajectory-阅读笔记
- 3.2
- 日式键盘与美式键盘转换
- Hive数据倾斜
- 图像处理与计算机视觉:基础,经典以及最近发展(2)图像处理与计算机视觉相关的书籍
- dubbo源码之Adaptive注解
- JavaSE 学习参考:方法的可变参数
- String数据类型和数值变化的思考
- 问题B:万妖穴
- 从零移植uboot 2017 到nuc970(第五天)