gcc and file reading HELP!!
Steven I. Pollmann
Sun Oct 26 12:46:00 GMT 1997
Sorry about the message, but I'm having a problem with my "c"
program reading lines of text from a file with gnu-win32. The file compiles
fine, but when it executes,
the lines are displayed, and then stack errors are reported to the screen at
the end, terminating the program. The program appears to work fine on the
Unix operating system we have at school. Please help, I'd like to get this
working with windows.
here is the program:
#define maxFilename 40
int OpenFile(FILE **filePoint, char fileName [maxFilename]);
void CloseFile(FILE **filePoint);
void PrintFileContents(FILE **filePoint);
printf("Enter a file to open: \n");
printf("file \"%s\" is being opened...",userFile);
if (OpenFile(&sourcefp, userFile) == 1)
printf("file \"%s\" opened.\n",userFile);
printf("file \"%s\" closed.\n",userFile);
/* open file for reading */
int OpenFile(FILE **filePoint, char fileName [maxFilename])
if ((*filePoint = fopen(fileName,"r")) == NULL)
printf("Can't open %s for reading \n",fileName);
*filePoint = fopen(fileName,"r");
/*close file */
void CloseFile(FILE **filePoint)
/* Print File contents */
void PrintFileContents(FILE **filePoint)
while ((fscanf(*filePoint,"%s",info)) != EOF)
For help on using this list (especially unsubscribing), send a message to
"email@example.com" with one line of text: "help".
More information about the Cygwin