0

I'm trying to make a copy of path, here is what I have:

char *path = getenv("PATH");
char *path_copy;
path_copy = (char*)malloc(sizeof(path));
memcpy(path_copy, path, sizeof(path));

and now path is: /soft/linux/bin:/usr/local/bin:/usr/bin:/bin: (etc) but path_copy is: /soft/li

what am I doing wrong?

dlmeetei
  • 9,905
  • 3
  • 31
  • 38
HOHO
  • 71
  • 1
  • 1
  • 4

0 Answers0