Quelle est la fonction dans C retourne le répertoire courant? (Parmi UNIX)Quelle est la fonction dans C retourne le répertoire courant?
4
A
Répondre
9
La norme POSIX est getcwd()
, ce qui signifie «get current working directory».
6
getcwd
. Sur ma boîte:
GETCWD(3) Linux Programmer's Manual GETCWD(3) NAME getcwd, getwd, get_current_dir_name - Get current working directory SYNOPSIS #include char *getcwd(char *buf, size_t size); char *getwd(char *buf); char *get_current_dir_name(void);
2
Ici, cela vous aidera:
#include <stdio.h>
#include <unistd.h>
main()
{
printf("you are currently in: %s", get_current_dir_name());
}
sortie:
/home/me/Desktop/tmp