Good time of day. There is a class, he has a member
const char **_files_container; If I understand correctly, this is an array of "C strings". In the constructor, I initialize this array
this->_files_container = new const char*[10]; Thus, I can put 10 const char [] in it;
Next, I use the library boost :: filesystem, browsing through the folder and the found files just want to be _files_container into this very _files_container as text
Here I encounter a problem:
itr->path().string(); Returns the string, as it should, but of type string , but I need it turns out const char*;
Well, I can transform such differences with c_str() :
this->_files_container[0] = itr->path().string().c_str(); And here is the gag. I deduced in the console cout << this->_files_container[0] << endl; and get .. just some graphical artifacts of some kind, either empty or just the letter e .
If you fill the array with your hands, for example:
this->_files_container[0] = "Fire in the hole!"; That all works as it should.
What am I missing or do not know, tell me what the problem is?