All pastes #1650942 Raw Edit

Unnamed

public c v1 · immutable
#1650942 ·published 2009-10-31 22:19 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>unsigned char get_xorval_fromfile(const char *infile){    int fd;    char *buf;    ssize_t ret;      printf("infile = %s\n", infile);   fd=open(infile,O_RDONLY,0);  if (fd<0){        perror("Open");        exit(1);    }    ret = read(fd,buf,1);    if (ret<0) {        perror("Read");        exit(1);      }    while (ret>0){            printf("I read %d bytes\n",ret);            printf("buf=%s\n",buf);            ret = read(fd,buf,1);        }}int main (int argc, char ** argv){    get_xorval_fromfile(argv[1]);}