2010-02-01 9 views
-2

MP3 파일을 읽고 C++을 사용하여 해당 파일 이름을 표시하는 방법은 누구든지 C++에서이 코드를 제공 할 수 있습니까?주어진 폴더에서 mp3 파일을 읽는 방법은 무엇입니까?

+0

dirent.h를 : http://www.opengroup.org/onlinepubs/007908799/xsh/dirent.h.html –

+1

속는 http://stackoverflow.com/questions/306533/how-do-i -get-a-list-of-a-directory-in-c –

+0

-1 코드를 보여줍니다. – Skurmedel

답변

1

부스트 파일 시스템 라이브러리를 사용하면 사용자의 필요에 맞는 매우 강력한 라이브러리입니다. 문서는 쉽게 당신이 코드의이 작은 조각을 쓰기 할 수 있도록해야 자신 : http://www.boost.org/doc/libs/1_31_0/libs/filesystem/doc/index.htm 난 그냥 당신이 예를 실제로 복사 할 수 있습니다 약간 수정하는 것을보고

: 당신이 부스트 파일 시스템을 사용할 수있는 휴대용 구현을 위해 http://www.boost.org/doc/libs/1_31_0/libs/filesystem/example/simple_ls.cpp

0

에서 작업 사용하여 신속한 답변 (거의 완료)입니다 boost.filesystem이고, 예는 basic_directory_iterator이다.

void iterate_over_mp3_files(const std::string & path_string) 
{ 
    path dir_path(path_string); 
    if (exists(dir_path)) 
    { 
    directory_iterator end_itr; // default construction yields past-the-end 
    for (directory_iterator itr(dir_path); 
      itr != end_itr; 
      ++itr) 
    { 
     if (###) // test for ".mp3" suffix with itr->leaf() 
     { 
     path path_found = itr->path(); 
     // do what you want with it 
     } 
    }  
}  
관련 문제