Suppose I have a hex string that I have calculated from a set of bytes, in a particular format that suits me:
std::string s("#00ffe1"); And I less than sign it to std::cout
std::cout << s; //prints: #00ffe1 Although I like the way cout works, for my purposes it is easier to use fprintf, as this is outputting a formatted string that is just easier with fprintf.
I go to write the same string from fprintf:
fprintf(stdout,"foo=%s",s); // outputs: G* // (i.e., nonsense) How do I output this string using fprintf?
cout << "foo=" << s;?