All pastes #907211 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-02-17 11:25 UTC
rendered paste body
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main(void)
{
int fd,readBytes;
char buff[255];

if( (fd = open("test.txt",O_RDONLY) )<0)
{
perror("error:");
exit(1);
}


while( (readBytes=read(fd,buff,255)) > 0);

int i;
for(i=0;i<readBytes;i++)
printf("%c",buff[i]);

printf("%d %d\n",readBytes,fd);


close(fd);
}