根据 the GNU Lib C documentation on getcwd() ... 这个函数的GNU C库的版本还允许您指定缓冲参数空指针。然后getcwd自动分配一个缓冲区,就像malloc一样(参见Unconstrained Allocation)。如果大小大于零,那么缓冲区很大;否则,缓冲区的大小必须足以保存结果。 我现在提请大家注意使用标准GETCWD()的实施,GNU文档中描述
我误解了getcwd手册页的引用部分? char *getcwd(char *buf, size_t size);
...
As an extension to the POSIX.1-2001 standard, Linux (libc4, libc5,
glibc) getcwd() allocates the buffer dynamically using m
上没有这样的文件或目录我试图编译ARM代码在Ubuntu 12 一切工作正常,当我把代码在本地目录。 但是,当我把引用安装目录错误代码显示出来: making testXmlFiles
sh: 0: getcwd() failed: No such file or directory
ARM Compiling xxxxx.c
sh: 0: getcwd() failed: No such