Prev Previous Post   Next Post Next
Old 01-10-2018, 07:59 AM   #29
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,746
Default

Quote:
Originally Posted by fundorin View Post
We have dec int position with value 11. Printed as double.
We write position into num1 in hex format as a string, adding "\x" in front and making it two characters, minimum. Printed as a string.
We write num1 into num2 in string format as a string. Printed as a string.
We assign "\x0B" text string as a value to num3. Cannot be printed as a string. Why?!
If we convert it into string with a function, then it can be printed as a string.
How come that direct assignment makes that "\x0B" string a hex value for oscii-bot?
I think the key here is that num1 and num2 refer to strings that are 4 bytes long ("\", "x", "0", and "B"), and num3 refers to a 1 byte string with the value of 11. If you want it to be a 4 byte string, you could use "\\x0B" instead of "\x0B". Does that help?
Justin is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:08 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.