Re: Append a hex value to an AnsiString - TYPO


2005-02-17 07:27:49 PM
cppbuilder83
My Typo, see below for the correct code
Quote
Ok, thanks for the help so far. How can I perform the following?

#define STX '\x02'
#define ADDR '\x45'

txBuf->Write(STX ADDR, 2);

This is not valid. I am wanting too just write those two bytes into the
stream. If I #define them in double quotes (") then it works, but I have
them in single quotes as later in the file I do the following on some
recieved data:

switch(*Buffer)
{
case STX:
// blah blah
break;
// more cases
}

If I have the #define's in double quotes then the switch-case statement
doesn't work.

Any suggestions?

Thanks,

Phil V

"Phil V" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...
>Thank you Remy!
>
>That was what I was looking for, once I could inspect the contents of the
>TMemoryStream it was obvious that I had tried to put \0x45 into the
>stream rather than \x45.
>
>Thanks again,
>
>Phil V
>
>"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
>news:4213a88d$ XXXX@XXXXX.COM ...
>>
>>"Phil V" < XXXX@XXXXX.COM >wrote in message
>>news:42139367$ XXXX@XXXXX.COM ...
>>
>>>I know, I wasn't asking for a solution to my problem here, I
>>>was just asking if there was a way to look at the data that a
>>>TMemoryStream contained via the watch window.
>>
>>TMemoryStream is dynamically-sized, and watches need to have the data
>>size
>>specified. I tried to view a TMemoryStream in the Watch window, and it
>>kept
>>complaining that the Repeat count was invalid even though it really
>>wasn't.
>>
>>You can, however, view the stream in a debug Inspector instead. Just
>>view
>>the stream's Memory property and then cast it to unsigned char* since it
>>is
>>declared as void*. Also, set the range of the Inspector to be the
>>current
>>Size of the stream.
>>
>>>I wrote the code as per here and that worked fine, then I tried
>>>to expand upon it, and now it does not work.
>>
>>Please elaborate.
>>
>>
>>Gambit
>>
>>
>
>