我试图复制路径,这就是我所拥有的:
char *path = getenv("PATH");
char *path_copy;
path_copy = (char*)malloc(sizeof(path));
memcpy(path_copy, path, sizeof(path));
现在路径是:/ soft / linux / bin:/ usr / local / bin:/ usr / bin:/ bin :(等) 但path_copy是:/ soft / li
我做错了什么?