실행 파일의 경로입니다. 되지 않는; 사용 _get_pgmptr 및 _get_wpgmptr.
구문
extern char *_pgmptr;
extern wchar_t *_wpgmptr;
설명
프로그램이 명령 인터프리터(Cmd.exe)에서 실행될 때 _pgmptr은 자동으로 실행 파일의 전체 경로로 초기화됩니다. 예를 들어 Hello.exe C:\BIN에 있고 C:\BIN이 경로 _pgmptr 에 있는 경우 다음을 실행할 때로 C:\BIN\Hello.exe 설정됩니다.
C> hello
명령줄 _pgmptr 에서 프로그램을 실행하지 않으면 프로그램 이름(파일 이름 확장명 없이 파일의 기본 이름) 또는 파일 이름, 상대 경로 또는 전체 경로로 초기화될 수 있습니다.
_wpgmptr은 _pgmptr을 사용하는 프로그램에 사용할 wmain에 대응하는 와이드 문자입니다.
일반 텍스트 루틴 매핑
| Tchar.h 루틴 | _UNICODE 및 _MBCS 정의되지 않음 |
정의된 _MBCS |
정의된 _UNICODE |
|---|---|---|---|
_tpgmptr |
_pgmptr |
_pgmptr |
_wpgmptr |
요구 사항
| 변수 | 필수 헤더 |
|---|---|
_pgmptr, _wpgmptr |
<stdlib.h> |
예시
다음 프로그램에서는 _pgmptr의 사용을 보여 줍니다.
// crt_pgmptr.c
// compile with: /W3
// The following program demonstrates the use of _pgmptr.
//
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
printf("The full path of the executing program is : %Fs\n",
_pgmptr); // C4996
// Note: _pgmptr is deprecated; use _get_pgmptr instead
}
_wpgmptr를 %Fs로 변경하고 %S을 main으로 변경하여 wmain을 사용할 수 있습니다.