| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1296 人关注过本帖
标题:有个地方没有看懂
取消只看楼主 加入收藏
chaw899
Rank: 2
等 级:禁止访问
帖 子:48
专家分:11
注 册:2018-11-29
结帖率:88.89%
收藏
 问题点数:0 回复次数:0 
有个地方没有看懂
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>

int main()
{
  char block[1024];
  int in,out;
  in = open("file1",O_RDONLY);
  out = open("file8",O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR);
  char buf[1024];

  int bytes_to_read;
 
    for (;bytes_to_read;)     // 这里和 for(;;) 和 while(1) 没有区别吗?
    {
        int read_chunk = bytes_to_read > sizeof(buf) ? sizeof(buf) : bytes_to_read;
        int bytes_read = read(in, buf, read_chunk);
        printf("%d\n",read_chunk);
        printf("%d\n",bytes_read);

        if (bytes_to_read < 0)
        {
            printf("Error reading context.\n");
        }
        printf("Test%d\n",read_chunk);
        printf("Test%d\n",bytes_read);
        bytes_to_read -= read_chunk;
    }
  exit(0);
}
搜索更多相关主题的帖子: include int out open printf 
2019-07-17 21:25
快速回复:有个地方没有看懂
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019777 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved