All pastes #262462 Raw Edit

Mine

public c v1 · immutable
#262462 ·published 2006-11-30 15:36 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>#include <string.h>int my_read(void *, char *, int);int main(int argc, char *argv[]){  FILE *fp;  char buf[100] = "";  if (argc < 2) {    fprintf(stderr, "usage: %s filename\n", argv[0]);    exit(EXIT_FAILURE);  }  fp = fopen(argv[1], "rt");  if (!fp) {    perror("fopen");    exit(EXIT_FAILURE);  }  fp->_read = my_read;  /* override NetBSD's read function */  fread(buf, sizeof(char), 10, fp);  printf("%s\n", buf);  fclose(fp);  return EXIT_SUCCESS;}int my_read(void *cookie, char *buf, int n){   return __sread(cookie, buf, n);}