I'm trying to cut the first 4 chars (PWD=) of the environment variable, my_envp, which in this instance is "PWD=/home/usrnm/cprgms/project"
This is my attempt:
The second printf does not print anything. If I replace '\0' with a different character like 'k' it prints "kkkk/home/usrnm/cprgms/project"
char pwd = "PWD=";
printf("my_envp is: %s\n", my_envp);
memset(my_envp, '\0', strspn(pwd, my_envp));
printf("my_envp is now: %s\n", my_envp);
My questions are: What am I doing wrong? and why doesn't my implementation work logically?
Thanks in advance for any help.