boost::filesystem::path corruption
Hello all, I've recently started using some of the Boost libraries, one of which being boost::filesystem. I have however encountered a problem while using the library, which as far as I can tell is a bug. I'm not sure if anyone is aware of this problem, or if is not an issue with the library itself but rather with my configuration - in either case a description of the problem follows: Whenever I instantiate a boost::filesystem::path object and try to print out a text representation of the path using a method such as .string(), the path itself is printed out, however it looks as though the string is not terminated properly as a whole bunch of trailing garbage appears after the path. The following sample program produces the problem for me: #include <iostream> #include <boost/filesystem/path.hpp> int main(int c, char** v) { boost::filesystem::path testpath("test/path"); std::cout << testpath.native_file_string() << std::endl; return 0; } When I run this code I get output similar to the following: test/pathpÿÿÿÿtest/ÿÿÿÿdataÿÿÿÿpath... etc (a whole bunch of other random stuff like days of the week & month, as well as garbage character strings) Can anyone shed some light on this for me? I'm running boost version 1.31.0 on Gentoo Linux x86 (kernel 2.6.5-gentoo-r1) with GCC version 3.3.2, for anyone who is interested. Regards, Stuart Bingë
Hi Stuart,
The following sample program produces the problem for me:
#include <iostream> #include <boost/filesystem/path.hpp> int main(int c, char** v) { boost::filesystem::path testpath("test/path"); std::cout << testpath.native_file_string() << std::endl; return 0; }
When I run this code I get output similar to the following:
test/pathp????test/????data????path... etc (a whole bunch of other random stuff like days of the week & month, as well as garbage character strings)
Can anyone shed some light on this for me? I'm running boost version 1.31.0 on Gentoo Linux x86 (kernel 2.6.5-gentoo-r1) with GCC version 3.3.2, for anyone who is interested.
I can't reproduce this either with Debian 1.31 package or with current CVS. I'm afraid you'd need to do some debugging. - Volodya
participants (2)
-
Stuart Bingë
-
Vladimir Prus