I have saved paths in a text file and would like to read them out. With these paths I want to read new text files, but if I call fopen () with a variable, the program only crashes. The paths I save are absolute. I have already tried to read the files without variables, which also worked.
FILE *fp;
FILE *variable;
char file[256];
fp = fopen("C:\\Example\\Example.txt","r");
if(fp != NULL)
{
while(fgets(file, 256, fp) != NULL)
{
variable = fopen(("%s", file), "r");
// another while loop which reads out the content of the variablefile
fclose(variable);
}
fclose(fp);
}