Share via


PathIsRootA 함수(shlwapi.h)

경로 문자열이 볼륨의 루트를 참조하는지 여부를 결정합니다.

구문

BOOL PathIsRootA(
  [in] LPCSTR pszPath
);

매개 변수

[in] pszPath

형식: LPCTSTR

유효성을 검사할 경로가 포함된 최대 길이 MAX_PATH null로 끝나는 문자열에 대한 포인터입니다.

반환 값

형식: BOOL

지정된 경로가 루트이면 TRUE 를 반환하고, 그렇지 않으면 FALSE 를 반환합니다.

설명

"", "X:" 또는 "\\server\ share"와 같은 경로에 대해 TRUE반환합니다. ".와 같은 경로입니다. \path2" 또는 "\\server"는 FALSE를 반환합니다.

예제

#include <windows.h>
#include <iostream.h>
#include "Shlwapi.h"

void main( void )
{
// String path name 1.
char buffer_1[ ] = "C:\\";
char *lpStr1;
lpStr1 = buffer_1;

// String path name 2.
char buffer_2[ ] = "path\\file";
char *lpStr2;
lpStr2 = buffer_2;

// Variable to get the return from "PathIsRoot".
int retval;

// Test case with path not absolute.
retval = PathIsRoot(lpStr1);
cout << "The return from function is       :" << retval << endl;
cout << "The path does contain a root part :" << lpStr1 << endl;

// Test case with path absolute.
retval = PathIsRoot(lpStr2);
cout << "The return from function is       :" << retval << endl;
cout << "The path does not contain part    :" << lpStr2 << endl;
}

OUTPUT:
============
The return from function is       :1
The path does contain a root part :C:\
The return from function is       :0
The path does not contain part    :path\file
============

참고

shlwapi.h 헤더는 UNICODE 전처리기 상수의 정의에 따라 이 함수의 ANSI 또는 유니코드 버전을 자동으로 선택하는 별칭으로 PathIsRoot를 정의합니다. 인코딩 중립 별칭을 인코딩 중립이 아닌 코드와 혼합하면 컴파일 또는 런타임 오류가 발생하는 불일치가 발생할 수 있습니다. 자세한 내용은 함수 프로토타입에 대한 규칙을 참조하세요.

요구 사항

   
지원되는 최소 클라이언트 Windows 2000 Professional, Windows XP [데스크톱 앱만 해당]
지원되는 최소 서버 Windows 2000 Server[데스크톱 앱만]
대상 플랫폼 Windows
헤더 shlwapi.h
라이브러리 Shlwapi.lib
DLL Shlwapi.dll(버전 4.71 이상)