So I have two hex strings - "3b101c091d53320c000910"
and "071d154502010a04000419"
. When I use strtol()
on them I get same value for both strings.
I tried the following code-
string t1="3b101c091d53320c000910";
long int hext1=strtol(t1.c_str(),0,16);
string t2="071d154502010a04000419";
long int hext2=strtol(t2.c_str(),0,16);
cout<<hext1<<endl;
cout<<hext2<<endl;
Both are giving me same value: 9223372036854775807
.
I dont know how strtol() works exactly since I am new to C++ but it's giving me same value for two different hex strings. Why?