24 Apr
2008
24 Apr
'08
8:41 a.m.
Mohan gupta wrote:
hello every one, can anyone please tell me is there any way to find the files in a directory with some exension say .txt,.doc, .cpp etc ......and then use them ???? all help is appreciated mohan gupta namespace bfs=boost::filesystem;
bfs::path p("/home/user/folder"); bfs::directory_iterator dir_iter(p), dir_end; for(;dir_iter != dir_end; ++dir_iter) { if( bfs::extension(*dir_iter) == ".txt" ) do_something(); elseif( bfs::extension(*dir_iter) == ".doc" ) do_something_different(); } For the most part not my code :-) Cheers, Brad