Long story short, I'm trying to fix a program written a while ago that is no longer supported by the guy who wrote it. However, I'm getting a few (ok, a ton) of errors; most of them I can figure out but this one is confusing me. The error it's giving when I compile is:
[quote]asdf.c:4041: warning: comparison between pointer and integer
asdf.c:4042: warning: comparison between pointer and integer[/quote]
and here is the code surrounding it...
[code]int savefile(filename,buffer,mode,offset,size)
char *filename, *mode;
void *buffer;
long offset;
unsigned int size;
{
int error = 0;
if ((fp = fopen(filename, mode)) == NULL) goto trouble;
if (offset != 0)
if (fseek(fp, offset, 0) != 0){ fclose(fp);goto trouble;}
if (fwrite(buffer, size, 1, fp) == NULL) {fclose(fp);goto trouble;}
if (fclose(fp) < NULL) goto trouble;
return 1;
trouble:
sprintf(answer,"ERROR saving %s [error=%d]",filename,error);
msg("\n", answer, "",0);
return 0;
}[/code]
lines 4041 and 4042 are these two:
[code] if (fclose(fp) < NULL) goto trouble;
return 1;[/code]
comparison between pointer and integer?
Moderators: Moderator, Global Moderator
comparison between pointer and integer?
Love is all a matter of timing.
It's no good meeting the right person too soon or too late.
If I'd live in another time or place...
...my story might have had a very different ending.
It's no good meeting the right person too soon or too late.
If I'd live in another time or place...
...my story might have had a very different ending.
comparison between pointer and integer?
Got the answer, thanks Hayden
[code] if (fwrite(buffer, size, 1, fp) == 0) {fclose(fp);goto trouble;}
if (fclose(fp) < 0) goto trouble;[/code]
[code] if (fwrite(buffer, size, 1, fp) == 0) {fclose(fp);goto trouble;}
if (fclose(fp) < 0) goto trouble;[/code]
Love is all a matter of timing.
It's no good meeting the right person too soon or too late.
If I'd live in another time or place...
...my story might have had a very different ending.
It's no good meeting the right person too soon or too late.
If I'd live in another time or place...
...my story might have had a very different ending.
comparison between pointer and integer?
lol couldn't believe I actually knew how to fix this.. Boo @ Hayden for ruining my moment to make it look like I know a lot <img src=\'http://www.killanet.net/forum3/public/s ... >/blum.gif\' class=\'bbc_emoticon\' alt=\':P\' />
Usually if you fix one thing it will get rid of a ton of errors lol
Usually if you fix one thing it will get rid of a ton of errors lol
[align=center]

“If you stop learning, you stop living.” ~Tami Quiring
“It's the rare man who understands the value of a single perfect rose.”
[/align]

“If you stop learning, you stop living.” ~Tami Quiring
“It's the rare man who understands the value of a single perfect rose.”
[/align]

