fopen returns a pointer and your seeing if it == -1... if (fp==NULL), maybe. 
depending on what lib your using. see what the return type is.
Thanks,
~~TheCreator~~
Visit TDS for quality software and website production
http://tysdomain.com
visit the piratecafe for programming related resources:
http://piratecafe.net
msn: [EMAIL PROTECTED]
skype: st8amnd127
  ----- Original Message ----- 
  From: Bill Cunningham 
  To: [email protected] 
  Sent: Friday, August 08, 2008 2:37 PM
  Subject: [c-prog] warning


  I get a comparsion between pointer and integer (I believe) errror for 
  this code. It is the line after the fclose function. Can anyone help me 
  understand what's going on. Disregard the ex macro. Since this is going to 
  be used by no one but me I thought I'd save a few keystrokes.

  #include <stdio.h>
  #include <stdlib.h>
  #define ex exit(EXIT_FAILURE)

  int main(int argc,char *argv[]) {
  if (argc >4) {
  puts("print usage error");
  ex;
  }

  FILE *fp;
  double x,y;
  x=strtod(argv[1],NULL);
  y=strtod(argv[2],NULL);
  if ((fp=fopen(argv[3],"a"))==NULL) {
  puts("open error");
  ex;
  }

  fprintf(fp,"%.2f\t%.2f",x,y);
  fclose(fp);
  if(fp==-1) {
  puts("close error");
  ex;
  }
  return 0;
  }

  Bill



   

  __________ NOD32 3338 (20080807) Information __________

  This message was checked by NOD32 antivirus system.
  http://www.eset.com


[Non-text portions of this message have been removed]

Reply via email to