Hi all,
I have been writing a function which opens a file and return the handling for future use… I’m missing something there… can you please help?
Code:#include <stdio.h> #include <stdlib.h> #include <string.h> FILE* openFile (char* text, char* handleName); void main () { openFile ("enter filename: ", "myHandleName"); } FILE* openFile (char* text, char* handleName) { char fileName[25]; printf ("%s", text); scanf ("%s",fileName); handleName=fopen (fileName,"rt"); //opening second file for reading. if (handleName==NULL) { printf ("\nCannot open second file: %s\n",fileName); exit(0); } return (handleName); }



LinkBack URL
About LinkBacks



