用long getcwd(char *buf, unsigned long size);
#include <stdlib.h>
#include <stdio.h>
#define MAXPATH 128
int main()
{
char buf[MAXPATH];
getcwd(buf, MAXPATH);
printf("The current directory is :%s \n", buf);
exit(0);
}
本文介绍了一个简单的C程序,用于获取并打印当前的工作目录。通过使用getcwd函数,程序能够读取指定大小的缓冲区,并输出当前所在的文件夹路径。
用long getcwd(char *buf, unsigned long size);
#include <stdlib.h>
#include <stdio.h>
#define MAXPATH 128
int main()
{
char buf[MAXPATH];
getcwd(buf, MAXPATH);
printf("The current directory is :%s \n", buf);
exit(0);
}
548
344

被折叠的 条评论
为什么被折叠?