I'm surprised you figured out how to attach images. You've been here long enough to know how code-tags work, so please use them.
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
Not getting an error for the undefined _CARTERR should indicate that WIN32 is not defined. So CARTERR is never filled with a string. So you try to open a file given by an undefined filename. This likely fails, but you don't check for success. So you probably try to fprintf to NULL.
Adding error-checking code would have caught this.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
I have defined CARTERR as char CARTERR[255]; so I din't get the error or warining !
I cant understand what you mean in the above lines. Could you explain more?
Sure. When I said _CARTERR I meant _CARTERR , not CARTERR . :P
Hopefully my last post makes sense now. :)
Change #ifdef WIN32 to #if 1 for a moment.
main.c: In function `main':
main.c:13: error: `_CARTERR' undeclared (first use in this function)
Then change it to #if 0 . Which attempted build matches the output you see for #ifdef WIN32 ? For me, it matches the #if 0 case. Which tells me that this line is not compiled:
sprintf( CARTERR,"%s\\%s",getenv("GVS"),_CARTERR);
Without that line, what file are you opening?
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
http://predef.sourceforge.net/preos.html#sec24
may be __WIN32__ is what you originally mean , see isn't this is a typo ?Normally preprocessor macros that are used by the compiler
or linker internally does start with _ or __ .
No. I meant exactly what I said.
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314