Skip to main content
gamedev.net
🔒 Locked

insert byte values

Started by andrewcw 2 replies 350+ views
Original Post
andrewcw
andrewcw
I am trying to append the low and high byte values into a sting being build by _bstr_t but .... I just dont understand how to do it... Here''s a sample of my tiny function: Thanks BSTR oneEntity() { // easy one - straight ascii //_bstr_t bstr1(_T("</body></html>")); // goal - insert unicode value between body tags for BSTR byte hibyte = 03; byte lowbyte = 136; // OCTAL 136 = DEC 94; goal unicode 916 ( small delta ). //wchar_t* s3=lowbyte + hibyte; // this does not work either... _bstr_t bstr2(_T("")); bstr2+= lowbyte + hibyte; // // APPEND BYTES how ??? _bstr_t bstr3(_T("</body></html>")); bstr2+= bstr3; // concatenate this to end. // unicode</body></html> BSTR bstrHTML; bstrHTML = bstr2.copy(); return bstrHTML; } andrew
andrew
bobstevens
bobstevens
quote:
Original post by andrewcw
byte lowbyte = 136; // OCTAL 136 = DEC 94; goal unicode 916 ( small delta ).



you want
byte lowbyte = 0136;  
if you're actually going for octal. The leading 0 makes it an octal number.

I don't know much about _bstr_t, but my guess is you'll want to do:

// bstr2+= lowbyte + hibyte; // // APPEND BYTES how ???
bstr2 += hibyte;
bstr2 += lowbyte;




[edited by - bobstevens on May 6, 2004 1:15:28 PM]
andrewcw
andrewcw
I appreciate that start on making byte value correct... but I need to know how to append the bytes :

bstr2+= lowbyte + hibyte; // // APPEND BYTES how ??? Thanks
andrew
andrewcw
andrewcw
BSTR oneEntity()
{ // easy one - straight ascii
//_bstr_t bstr1(_T("</body></html>"));
// goal - insert unicode value between body tags for BSTR
WCHAR pwch[] = { 916, 0 }; // THIS WAS THE SOLUTION

_bstr_t bstr2(_T(""));

bstr2 += pwch; // THIS WAS THE SOLUTION

_bstr_t bstr3(_T("</body></html>"));
bstr2+= bstr3; // concatenate this to end.

// unicode</body></html>
BSTR bstrHTML;
bstrHTML = bstr2.copy();

return bstrHTML;
}
andrew

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.