该函数的调用方式如下所示:
INTEGER*4 getcwd status = getcwd( dirname ) |
|||
dirname |
character*n |
输出 返回当前目录的路径 |
当前工作目录的路径名称。n 必须足够大,以便能容纳最长的路径名称 |
返回值 |
INTEGER*4 |
输出 |
status=0:OK status>0:错误代码 |
示例:getcwd:
INTEGER*4 getcwd, status character*64 dirname status = getcwd( dirname ) if ( status .ne. 0 ) stop ’getcwd: error’ write(*,*) dirname end |
另请参见:chdir(3F)、perror(3F) 和 getwd(3)。
注意:路径名长度不能超过 <sys/param.h> 中定义的 MAXPATHLEN 值。