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
  • 8,817
  • 3
  • 29
  • 37
HOHO
  • 61
  • 1
  • 3

0 Answers0