faizul | hi | 09:08 |
---|---|---|
faizul | hi hyperair | 09:24 |
hyperair | hi | 09:24 |
excalibr | hyperair: o/ | 13:23 |
excalibr | how do you print out the date_string var in this code | 13:24 |
excalibr | https://github.com/GNOME/gnote/blob/master/src/test/dttest.cpp#L71 | 13:24 |
angch | cout << date_string // ?? | 13:25 |
excalibr | why cannot use printf | 13:27 |
excalibr | test/dttest.cpp:82:97: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘std::string {aka std::basic_string<char>}’ [-Wformat] | 13:27 |
excalibr | i wrote printf ("bablabla %s \n", date_string); | 13:27 |
angch | because std::string is not char * ...? | 13:29 |
angch | unicode and all that. | 13:29 |
excalibr | ahh sorry :P | 13:33 |
hyperair | excalibr: \o | 14:58 |
hyperair | std::string has a different memory representation than a char* | 14:58 |
hyperair | if you try to printf an std::string, things will go wrong. very horribly | 14:58 |
angch | well, there's always sprintf("%s", date_string.c_str()); // Hackity hack. C++ is not C, stop mixing and matching me! | 15:07 |
angch | http://www.cplusplus.com/reference/string/string/c_str/ | 15:07 |
angch | sorry, snprintf, etc, etc. | 15:08 |
angch | rusty | 15:08 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!