티스토리 뷰

_splitpath() 함수를 사용하면 경로에서 원하는 정보만 추출할수 있다..(분리...)

_splitpath() 함수를 사용하면 전체경로에 대해서 드라이브명, 경로, 파일명, 확장자로 구분해준다.

함수의 원형
    void _splitpath(
         const char *path,
         char *drive,
         char *dir,
         char *fname,
         char *ext
    );


path : Full path 
(분리 시킬 경로의 절대경로...)

drive : Optional drive letter, followed by a colon (:) 
(드라이브...)

dir : Optional directory path, includingtrailing slash. Forward slashes ( / ), backslashes ( \ ), or both may be used.
(드라이브와 파일명을 제외한 경로...)

fname : Base filename (no extension)
(확장자를 제외한 파일명...)

ext : Optional filename extension, including leading period (.)
( '.'을 포함한 확장자...)


ex)  _splitpath("C:/Documents and Settings/gungume/바탕 화면/Console/Console.dsw", drive, dir, fname, ext);

drive : C:
dir : /Documents and Settings/gungume/바탕 화면/Console/
fname : Console
ext : .dsw

필요없는부분은 NULL로 안받아와도된다.

_splitpath( strFileName, NULL, NULL, strTemp, NULL);    //확장자 분리


'C/C++' 카테고리의 다른 글

C++ const 키워드 사용하기  (0) 2011.07.01
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함