FILE fp char line NULL size_t len ssize_t read char program 1024 fp fo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
FILE * fp;
char * line = NULL;
size_t len = 0;
ssize_t read;
char program[1024];
fp = fopen("program.txt", "r");
if (fp == NULL)
return -1;
while (getline(&line, &len, fp) != -1) {
strcat(program, line);
}
fclose(fp);