problem with fopen()

Hi all,

while executing the folowing code I get an SIGSEGV excacltly when I hit
the fopen().

#include <stdio.h>

void main( void ) {

FILE *p_file;

if( (p_file = fopen(“foo.bar”, “wb+”)) != NULL ) {

// Write to file

fclose(p_file);
}

}



The watcom debugger stops at _allocfp + 15
“mov ecx,+4[esi]”

What could be the reason for this strange error?

Thanks,

Jens

Jens Benner wrote:

if( (p_file = fopen(“foo.bar”, “wb+”)) != NULL ) {

Don’t know if this is your problem, but that is an
invalid mode - try “w+b” instead …

John Garvey <jpg@cisco.com> wrote:

Jens Benner wrote:
if( (p_file = fopen(“foo.bar”, “wb+”)) != NULL ) {

Don’t know if this is your problem, but that is an
invalid mode - try “w+b” instead …

And, for what its worth, under QNX (4 or 6) there is no
difference between binary and text files for purposes of
this command.

-David

QNX Training Services
dagibbs@qnx.com