getcwd.c

来自「通讯程序源码」· C语言 代码 · 共 24 行

C
24
字号
/* * Can you believe it???  Masscomps don't have a function to return the * current working directory while in the AT&T universe! */#include <stdio.h>char *getcwd(buf, size)char *buf;int size;{	FILE *pfp, *n_popen();	if (!(pfp = n_popen("pwd", "r")))		return(".");	fgets(buf, size, pfp);	n_pclose(pfp);					/* zap the new line */	buf[strlen(buf)-1] = '\0';	return(buf);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?