Anonymous
Is possible
Anonymous
In the turbo C Borland
Anonymous
This is part of standard?
Anonymous
And removed standard c11
Anonymous
?
Anonymous
c99?
Anonymous
really i don'T know
Anonymous
and i've never used turbo c
Anonymous
The
And please write your thoughts in ONE message
Anonymous
And removed standard c11
Borland is not an existing company since 2009 It is not a smart decision to use products made by a dead company
Anonymous
It was just a curiosity, I don't use it on a daily basis.
Anonymous
Yes
It does no matter anymore
Anonymous
Thanks anyway
X3eRo0
Does any know
X3eRo0
How I can convert "xcb\x6d\x71\x1e\xec\xae\x34\xbd\xfe\x3f\x00\x00" this to long double in c
X3eRo0
I tried type casting the pointer and what not
X3eRo0
It doesn't work
X3eRo0
How do I convert
X3eRo0
"ab" to '\xab'
Talula
Add \x to ab
X3eRo0
\xab is a byte
X3eRo0
"ab" is a string of 2 charecters
Talula
You want to convert from hex to double?
X3eRo0
No
X3eRo0
"ab" is a string right
X3eRo0
I want to convert it to 0xab or \xab
Talula
Doesn't matter that is a Hex number...
Talula
Are you Indian?
X3eRo0
Are you Indian?
How is this important
Talula
Because you don't know what you're talking about.
Talula
0xAB is a string but it's in HEX format.
X3eRo0
Okay
Talula
Okay
https://www.geeksforgeeks.org/program-hexadecimal-decimal/
Talula
Use this to convert from HEX to Decimal
X3eRo0
Bro
X3eRo0
When I say "ab"
Dima
hahahahaha
X3eRo0
I mean char *p = "ab";
X3eRo0
Destruction 100000%
I don't mind it 😃
X3eRo0
Now p[0] = "a" or 0x61
Talula
a is ASCII
Talula
0x61 is Hex...
X3eRo0
I want to somehow convert this 2 byte string to a hex byte or number whatever you want to say
X3eRo0
0x61 is Hex...
a is 0x61 according to ASCII table
Talula
The link I gave above does that.
X3eRo0
a single charecter is treated as int in c
Talula
It converts your "HEX" numbers from String to Decimal.
Talula
X3eRo0
Okay
X3eRo0
But what if my string is "f00dbabe"
Talula
Doesn't matter the above program does the conversion...
X3eRo0
I want it like \xbe\xba\x0d\xf0 with little endianness
Talula
Oh that is it? You want to break the string into 2 bytes and print it like \x00?
X3eRo0
Yeah
X3eRo0
Also
Talula
And what is the big deal in that? for loop increment of 2 add '\x' before the two bytes.
X3eRo0
Common dude don't joke around
X3eRo0
\xbe\xba\x0d\xf0 is same as 0xf00dbabe in little endianess
X3eRo0
It's a number
X3eRo0
A python equivalent code would be
X3eRo0
import struct
Talula
I'm not joking... see problem is you're unable to explain things properly or I'm not asking the right question... If it's a string it's a string it doesn't matter... But if it's string of hex number it is still a string... If it's not a string then it doesn't matter what format it is in the memory... binary, hex, decimal... etc.
Anonymous
Talula
So what is it and what do you wanna do with it?
Anonymous
Anonymous
Any one pls explain this program
X3eRo0
struct.unpack("<I","\xbe\xba\x0d\xf0")
Pavel
Any one pls explain this program
I see there's an explanation in the book, what part of the program is not clear for you?
X3eRo0
@Tazmikar ok see I reframed my question
X3eRo0
How do I convert a string to raw bytes
X3eRo0
Like "f00dbabe" to it's raw bytes
X3eRo0
Your method won't work
X3eRo0
You can't just add \x
Talula
You mean converting 2 bytes at a time to decimal?