#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    1
    Rep Power
    0

    webpage->cgi->fopen


    I am using C to write a cgi that get data from a dhtml page and store them in a text file. However, the text file == NULL after I run the fopen command. I have run the sourceCode under the Unix shell and the source is oaky. (It write and safe files)

    this is my source in the c program:


    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    FILE *outfile;

    ...

    outfile = fopen("register.txt", "w");
    if(outfile==NULL){
    printf("An error has occured.\n");
    return 1;
    }

    fprintf(outfile, "Date registered:");
    fclose(outfile);
    ...

    Anything I have done wrong? Thanks.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    18
    Rep Power
    0
    Simple Question:
    Has the user who is running the webserver write access to the directory where your cgi-skript is running?

IMN logo majestic logo threadwatch logo seochat tools logo