I use getenv()
in my c code.
Here is the code I use
#include<windows.h>
#include<stdio.h>
int main()
{
char *path=getenv("USERPROFILE");
strcat(path,"\\bullshit");
char *newpath=getenv("USERPROFILE");
printf("%s",newpath);
}
The result of the print statement is
C:\Users\username\bullshit
Why does the getenv()
call to environment variable change due to strcat
?
NOTE: I am using minw-gcc compiler 32-bit on windows 8.1 system