#include
#include
int main(int argc, char**argv) {
char fileName[100] = “/root/data/”;
char c;
FILE *file;
strcat(fileName, argv[1]);
file = fopen(fileName, “r”);
if (file == NULL) {
printf(“Error, cannot open file\n”);
//fclose(file); // bad idea, it’s NULL
return 1;
} else {
while ((c = fgetc(file)) != EOF) {
putchar(c);
}
fclose(file);
}
return 0;
}