[filesystem] problem with filename length (bug?)

Here is the code I am using (the problem also occurs with the simple_ls.cpp sample)... #include <iostream> #include "boost/filesystem/operations.hpp" #include "boost/filesystem/path.hpp" namespace fs = boost::filesystem; int main( int argc, char* argv[] ) { fs::path dir( "somedir" ); fs::directory_iterator end; for( fs::directory_iterator i( dir ); i != end; ++i ) { std::cout << dir->leaf() << std::endl; } return 0; } The problem is that once the program finds a file at least 22 characters long, it will not print any filenames longer than first file correctly. In "somedir" are several long filenames. Here is the contents of the directory in the order the files were created: somereallyreallylongfilename somereallylongfilename someotherreallylongfilename somereallyreallylongfilenam3 somereallyreallylongfilenames The program outputs: somereallyreallylongfilename somereallylongfilename someotherreallylongfilename somereallyreallylongfilenam3 somereallyreallylongfi (here the output stops and goes back to my prompt) Anyone else had this problem? Thanks, Mike

"Allmen, Michael-P57512" <Michael.Allmen@gdc4s.com> wrote in message news:C7FCC5C93630AB4E80049ED163FFD224B5ED0B@AZ25EXM04.gddsi.com...
Here is the code I am using (the problem also occurs with the simple_ls.cpp sample)...
#include <iostream> #include "boost/filesystem/operations.hpp" #include "boost/filesystem/path.hpp"
namespace fs = boost::filesystem;
int main( int argc, char* argv[] ) { fs::path dir( "somedir" );
fs::directory_iterator end; for( fs::directory_iterator i( dir ); i != end; ++i ) { std::cout << dir->leaf() << std::endl; }
return 0; }
The problem is that once the program finds a file at least 22 characters long, it will not print any filenames longer than first file correctly.
What operating system are you using? What version of Boost? Thanks, --Beman
participants (2)
-
Allmen, Michael-P57512
-
Beman Dawes