I really don't get why I can't pass a FILE* to a function, have that function call fopen on that FILE*, and return to the caller with the FILE* still holding the address of the file object.
the call to fopen is successful, and the return status is SUCCESS, yet inFile becomes NULL after the function returns.Code:FILE* inFile = 0; openNextFile(inFile, argv[fileIndex], &fileIndex, argc); /* definition */ int openNextFile(FILE* inFile, char* fileName, int* fileIndex) { inFile = fopen(fileName, "rb"); (*fileIndex)++; if ( NULL == inFile ) { return FAILED; } return SUCCESS; }