I'm confused at the differences between (char*)'r' and "r", and perhaps (char*)"r", if that's different from "r".
int main () {
char fileNameOriginal[MAXLINE] = "test.txt";
openFile(&fp, fileNameOriginal, (char*)'r');
}
openFile(FILE **fp, char fileName[], char* mode) {
*fp = fopen(fileName, mode);
}
This format for passing the mode argument of fopen will not cause a warning/error by my eclipse IDE. However, the file will not be read correctly. On the other hand, passing "r" or (char*)"r" will generate a correct reading.