First, you need to add a space in path to match the contents of array[0] in strcat , otherwise you will write past the highlighted area.
Secondly, you do not pass path to fopen because you enclosed the "path" in double quotes.
char path[100] = "./textfiles/"; // Added some space for array[0] strcat( path, array[0] ); // Open the file FILE *in; in = fopen( path, " r " ); // removed quotes around "path" if (!in) { printf("Failed to open text file\n"); exit(1); }
dasblinkenlight
source share