Hello I've just finally figured out how to use the boost library fully I can check if a path object set to a filename is a directory , is a regular file, I can even list out the directory contents using a directory_iterator and cout that to cmd
but what I have tried too figure out is extension(p) function
my idea was to be able to use this extension(p) to check if any file in a folder are a extension of .txt for example
If I have a folder named folder1
It has 6 files in it
each with its own file extension like
.txt
.vim
.obj
.png
.bmp
.mp3
and now I wanted to check if any one of those files is of extension .vim
how would I do that using boost or this function extension()
note
I may be wrong on what function to use in boost for this kind of thing.
hmm no output yet in cmd It can't be the path object since its got the folder name correctly named ? hmm I tried also p.extension() == ".txt" still no results
yes your very right I'm able to list out a directory but I'm not able to check each string for .txt wording or the file extension it self directly this is my actual code
Well, looking at your code, you have p = ... on line 1, setting p equal to the directory. You never modify p, so on line 20 you are trying to get the extension of the directory.
Obviously, if you want to look at each file...you'll need to look at each file.