setenv() and getenv() explained

This is a discussion on setenv() and getenv() explained within the C Programming forums, part of the General Programming Boards category; can someone explain to me how setenv() and getenv() work if one is executing a cgi file within a C ...

  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 11: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, 05:32 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21