Thread: setenv() and getenv() explained

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    103

    setenv() and getenv() explained

    can someone explain to me how setenv() and getenv() work if one is executing a cgi file within a C file. [how setenv is modified/passed to the cgi file] Thanks.

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Have a look here:
    Apache Environmental Variables

    I think you mean script, not "cgi file". Whether that script uses QUERY_STRING depends on how it was written, in what language, and using what libraries. Eg, perl's CGI module does, but if you write a cgi script without such a library (which is easy, you just use stdin and stdout), then you would have to use a getenv() type function if you wanted to use QUERY_STRING instead of stdin.

    I also believe you must use POST in your form/http request to use QUERY_STRING.
    Last edited by MK27; 04-01-2010 at 10:17 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question about getenv...etc???
    By smd in forum C++ Programming
    Replies: 2
    Last Post: 08-12-2003, 04:32 AM