All pastes #774504 Raw Edit

Unnamed

public c v1 · immutable
·published 2007-11-15 09:22 UTC
rendered paste body
/* fread example: read a complete file */#include <stdio.h>#include <stdlib.h>#include <string.h>int main () {  FILE * pFile;  int i = 1;  long size;  char *filecontents;  char** authlist;    pFile = fopen ( "file.txt" , "r" );  fseek(pFile, 0, SEEK_END);  size = ftell(pFile);  fseek(pFile, 0, SEEK_SET);    filecontents = malloc(size);  fread (filecontents,1,size,pFile);while(authlist[i]=strtok(filecontents,"\r\n")!=NULL){printf(authlist[i]);i++;}  fclose (pFile);  getchar();  free (filecontents);  free(authlist);  return 0;}