有个地方没有看懂
#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);
}