GetEnvironmentVariable doesn't work
Алексей Павлов
alexpux@gmail.com
Wed Feb 27 06:55:00 GMT 2013
Hi!
I set some environment variable. When I try to get it with
GetEnvironmentVariable{A,W} it return empty result. With "getenv" I
can get variable value. Also I think GetEnvironmentVariable doesn't
work inside Cygwin.dll (maybe I wrong).
My example code is:
#include <stdio.h>
#include <windows.h>
int main()
{
char* res = getenv("MYVARIABLE");
if (res)
{
printf("MYVARIABLE (via getenv) is %s\n",res);
}
char gev_res[256] = {'\0'};
GetEnvironmentVariableA("MYVARIABLE",gev_res,256);
printf("MYVARIABLE (via GetEnvironmentVariableA) is %s\n",gev_res);
return 0;
}
Is it a bug of Cygwin feature that I can't use GetEnvironmentVariable?
Thanks, Alexey!
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list