fopen

Don't crash sdcc10 cs161fdu at sdcc10.ucsd.edu
Sun Jan 21 12:03:39 AEST 1990


I have a question:

Is there a reason why fopen will not work in my subroutines that are in a 
different file? fopen works when it is contained in the main program, but
when I put a routine containing fopen in a separate file, statements coming
after the fopen statements are never reached.  Once fopen is reached, the
routine seems to start over again.  I've check the code and everything is
correct to my knowledge.

Is.  File roughly looks like this:

int function()
{
.
.
.
FILE *fp;
fp=fopen("Anyfile","r"0;); //where "Anyfile" can be anyfile: ie.  test.data

.
.
.
return something;
}

The problem is that program execution does not go past fp=fopen(....).
The code is the exact same code in the main routine, so it should work.
I've tried playing with it, but no success.

Any help would be appreciated...

Gary (cs161fdu)



More information about the Comp.lang.c mailing list