i have worked out how to pass the boost path the required format, but i am having some issues figuring out hot to pass the path.stem into a char array, and then run some check on the filename and take the right action
need to read the filename and check for the next available number in the and then action, i was intending to use a for loop to get the number into an char array and then compare to this separate counter
how can i feed in the path() character by character into a array - or is there a better way !
int count(boost::filesystem::path input) {
cout << "inputzz : " << input << endl;
char data;
wstring winput;
for (int a = 0; a < 4;){
//boost::filesystem::absolute(input).string();
//cout << input.generic_string() << endl;
(input.generic_string()) >> data;
data << (boost::filesystem::path()input.generic_string());
//a++
};
Given a
bfs::path p
,p.c_str()
gives you access access to the null-terminatedchar*
array.https://www.boost.org/doc/libs/1_63_0/libs/filesystem/doc/reference.html#c_str
Full example:
From @Ivan's comment, it is likely that
char
is not the underlying representation in all systems. For that reason one migth need to use the value type of path, as inconst boost::filesystem::path::value_type* c = p.c_str();
and modify the rest of the code, and for example use the genericstd::copy
.