K
Kza
Hi, just in the process of maintaining some software that used some
funy old string library and char*s , and we are updating everything to
use std::strings. (or should I say std::basic_string<>s)
I find it wierd that that all the new c++ ansi style librarys like the
streams and file handling classes still expect us to use old style
char* type strings. For example, ofstreams open function expects the
filename as a char* parameter rather than a std::string, and the
streams redirection operator << doesnt even work with std::strings but
does with char*s.
I would have expected the opposite, (or perhaps both types of strings
are supported), in that std::strings are the native type of string for
these new c++ style libs.
Seems a bit like a case of not practicing what they are preaching "you
should all use these new style strings, er unless of course you also
need to use our other classes which still only support old style char*
strings"
I know its easy to solve with .c_str() but is there a reason for this?
funy old string library and char*s , and we are updating everything to
use std::strings. (or should I say std::basic_string<>s)
I find it wierd that that all the new c++ ansi style librarys like the
streams and file handling classes still expect us to use old style
char* type strings. For example, ofstreams open function expects the
filename as a char* parameter rather than a std::string, and the
streams redirection operator << doesnt even work with std::strings but
does with char*s.
I would have expected the opposite, (or perhaps both types of strings
are supported), in that std::strings are the native type of string for
these new c++ style libs.
Seems a bit like a case of not practicing what they are preaching "you
should all use these new style strings, er unless of course you also
need to use our other classes which still only support old style char*
strings"
I know its easy to solve with .c_str() but is there a reason for this?