how to a acces.....

can u tell me; how i can open the file in /cgi-bin directory for writing?

Comments

  • I'd suggest using fopen(), and fwrite(), with a the filename fully qualified
    e.g.
    fp = "/home/johndoe/cgi-bin/filename.txt";

    That sort of thing


  • thanks. but i think, i couldnt explain my problem clearly;
    actually i use C/C++ for CGI programs.and on the web i cant open a file for writing.the problem isn`t about syntax.the main problem is :
    I used "fopen("filename.dat","wr"),but this caused some errors,and my program didnt work,On a Unix server,because of permissions,but on a WIN98 server it worked.because there is nothing about permissions.

    How does a CGI program open(for writing) a file which is pathed
    "/cgi-bin/balh/balh../filename.dat", and writes someting to it,on a Unix based web server.


    Notice:I`m asking this question on PHP area, because this is CGI problem.

  • : actually i use C/C++ for CGI programs.and on the web i cant open a file for writing.the problem isn`t about syntax.the main problem is :
    : I used "fopen("filename.dat","wr"),but this caused some errors,and my program didnt work,On a Unix server,because of permissions,but on a WIN98 server it worked.because there is nothing about permissions.
    : How does a CGI program open(for writing) a file which is pathed
    : "/cgi-bin/balh/balh../filename.dat", and writes someting to it,on a Unix based web server.

    Try this :
    $filename="/path_to_file";
    chmod( $filename, 0777 ); // o -file, not directory 777 - to do what u want ( permission )
    $fp=fopen( $filename, "wr" );
    $str=fread( $fp, 100 );
    fclose( $fp );

    I think should work. On my Linux it is.

    Lekha.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories