You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
498 B

/*
* 测试通过时输出:
* "getcwd OK."
* 测试失败时输出:
* "getcwd ERROR."
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
void test_getcwd(void){
char *cwd = NULL;
char buf[128] = {0};
cwd = getcwd(buf, 128);
if(cwd != NULL) {
printf("current dir: %s\n", buf);
printf("getcwd OK.\n");
}
else printf("getcwd ERROR.\n");
}
int main(void){
test_getcwd();
return 0;
}