I always thought that the std::string constructor looked like this:
string(size_type n, const T& t)
this would mean, you should do this instead:
// note, size goes first and
// const T is char not a string (ie. not "-")
std::string s( 105, '-' );
Hope that works for you.
Gary Wessle wrote:
Hi
could some one please look at this and tell me why it is printing out
what it is.
all what I am trying to do is print out 105 of "-".
std::string s = string("-", 105 );
std::cout << s << std::endl;
out:
-%d-%d-%d %d:%d:%d8%G���%@X&%G�� %@x>%G���%@R%G��¢½Ã¯Â¿Â½Ã¯Â¿Â½Ã¯Â¿Â½Ã¯Â¿Â½Ã¯Â¿Â½Ã¯Â¿Â½Ã¯Â¿Â½%@zPL %G�%@
thanks