How do u pass file pointers by reference. I want to use a function to open a file but, I have trouble doing this, because once it gets out of the function the pointer isn't pointing to the file anymore. Can someone please help.
This is a discussion on FILE pointers within the C Programming forums, part of the General Programming Boards category; How do u pass file pointers by reference. I want to use a function to open a file but, I ...
How do u pass file pointers by reference. I want to use a function to open a file but, I have trouble doing this, because once it gets out of the function the pointer isn't pointing to the file anymore. Can someone please help.
Code:FILE * Function(FILE *fptr, filename) { return fptr = fopen(filename, "r"); }