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

Reply via email to