I have a program that is supposed to create multiple text files. What I did was create an array of pointers to point to the filenames, an array of pointers to point to the text for each file, and an array of FILE pointers to use with fopen(). The program compiles with no errors or warnings. Without showing the whole source, I have narrowed the problem down to one line (I think):
filepointer[counter] = fopen(filename[counter],mode);
filepointer is the array of pointers to type FILE, filename[] is the array of pointers pointing to the filenames, and mode is w. This line of code will not execute when the first argument to fopen is one of an array of pointers to a string. It works fine if i give it text ("file.txt") or just the name of a single string, but not if I give it a pointer from an array of pointers. I know that the string contains the text it is supposed to (For example, file.txt) because I checked it after the error occured. What am I doing wrong here? Also, I thought you couldn't pass arrays to functions? (unless they are arrays of pointers? is that right?)
filepointer[counter] = fopen(filename[counter],mode);
filepointer is the array of pointers to type FILE, filename[] is the array of pointers pointing to the filenames, and mode is w. This line of code will not execute when the first argument to fopen is one of an array of pointers to a string. It works fine if i give it text ("file.txt") or just the name of a single string, but not if I give it a pointer from an array of pointers. I know that the string contains the text it is supposed to (For example, file.txt) because I checked it after the error occured. What am I doing wrong here? Also, I thought you couldn't pass arrays to functions? (unless they are arrays of pointers? is that right?)
