All pastes #365885 Raw Edit

Something

public text v1 · immutable
#365885 ·published 2007-02-21 09:53 UTC
rendered paste body
#include <stdio.h>

#define MAXCHAR 200

main(int argc, char argv[])
{
        FILE *fp[argc-1];

        int x = 0;
        int y;
        char s[MAXCHAR];

        while(x < argc) {
                fp[x] = fopen(*++argv, "r");
                if(fp[x] == NULL) {
                   fprintf(stderr, "ERROR: Kan bestand %s niet openen\n", argv);                   
                   exit(1);
                }
                y = 1;
                printf("Bestand: %s\n", argv);
                while(fgets(s, MAXCHAR, fp[x]) != NULL) {
                        printf("%d: %s", y, s);
                        y++;
                }
                printf("\n\n\n");
                x++;
        }
}