#include <stdio.h> #include "files.h" int main (int argc, char *argv[]) { int cr; char *buff; if (argc != 2) { fprintf (stderr, "\nUsage: read_file.test <file name>\n"); return 1; } cr = read_file (argv[1], &buff); if (cr == FILES_UTIL_MALLOC_ERR) { fprintf (stderr, "\nMalloc error!\n"); return 1; } if (cr == FILES_UTIL_READ_ERR) { fprintf (stderr, "\nRead error!\n"); return 1; } if (cr == FILES_UTIL_OPEN_ERR) { fprintf (stderr, "\nOpen error!\n"); return 1; } fprintf (stdout, "\n\n%d bytes read:\n\n%s\n\n", cr, buff); free (buff); return 0; }