getcurdir

getcurdir是一種函式,功能是取指定驅動器的當前目錄。

基本介紹

  • 中文名:getcurdir
  • 函式名:getcurdir
  • 功 能:取指定驅動器的當前目錄
  • 用 法:int getcur
用法,程式例,

用法

int getcur

程式例

#include <dir.h>
#include <stdio.h>
#include <string.h>
char *current_directory(char *path)
{
strcpy(path, "X:\\"); /* fill string with form of response: X:\ */
path[0] = 'A' + getdisk(); /* replace X with current drive letter */
getcurdir(0, path+3); /* fill rest of string with current directory */
return(path);
}
int main(void)
{
char curdir[MAXPATH];
current_directory(curdir);
printf("The current directory is %s\n", curdir);
return 0;
}

相關詞條

熱門詞條

聯絡我們