On 12/13/2012 08:03 AM, Greg London wrote:
> Sorry, this seems like it would be easy, but I'm stumped.
>
> I bring in two integers and a string, and I want to
> create another string that contains the
> integers in hex format and the first string.
>
> It would be one line in perl or verilog.
>
> I can't get it to work at all in C++.
> And every example I've seen so far using stringstream
> seems to require many, many lines of code.
>
>
> void ActualExpected(int actual, int expected, const string &msg){
> stringstream ss;
>
>
> the next line would hopefully be something like this:
>
> ss << "actual=0x" << [actual in string hex format]
> << "expected=0x " << [expected in string hex format]
> << msg;
>
> But for the life of me, I can't get any examples to work.
> And all the examples use several lines of code.Try this: ss << "actual=0x" << std::hex << actual << " expected=0x" << std::hex << expected << " " << msg; -- Jerry Feldman <[email protected]> Boston Linux and Unix PGP key id:3BC1EB90 PGP Key fingerprint: 49E2 C52A FC5A A31F 8D66 C0AF 7CEA 30FC 3BC1 EB90
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Hardwarehacking mailing list [email protected] http://lists.blu.org/mailman/listinfo/hardwarehacking
