c - Why is PWD empty and how to fix it? -
I am using lighttpd and have written the following CGI script:
main } {Printf ("Content-Type: Text / HTML \ n \ n"); Four * pwd = ""; PWD = getenv ("PWD"); Printf ("Current Path:% s", PWD); } Result
The current path is: (null) Well, why do not I get it and I Do not know how to execute the path of the script. I am searching for [0] Razis with a path, and used PWD for it but maybe I should do something different.
UPDATE is not working well
four CWD [_PC_PATH_MAX + 1]; Getcwd (cwd, _PC_PATH_MAX + 1); is cwd "". It may be that my script knew that if I used to stop the 1408 room as my datacenter, then where was it. : P
Instead of using getcwd () . No need to set PWD . #include & lt; Unistd.h & gt; Char * getcwd (four * buf, size_t size);
Comments
Post a Comment