786 snippets from 1631 members, and growing!
|
login
|
join
about
bytebin
members
tags
snippets
join
Snippets
Submit a Snippet
Search Snippets
New Snippets
Top Snippets
Top Tags
PHP
(142)
JavaScript
(125)
Java
(66)
VBSCRIPT
(58)
String
(44)
CSS
(31)
File
(29)
CSharp
(28)
HTML
(27)
mysql
(27)
C
(24)
VB.NET
(24)
python
(24)
CPlusPlus
(23)
groovy
(23)
New Snippets
Detect Adblock
Concatenar campos...
fopen
Unique random key
get number of cha...
Find a File
Find a Directory
List Directory
File uploading in...
Get Values from C...
Venture Capital Jobs
New Members
mcheung63
cicero
mycodeofshailendra
nostromo
KennethCC
me
jamesmcm
Can
Kelmi
ysg
Top Members
dannyboy
sundaramkumar
mattrmiller
Pio
i_kenneth
ASmith
ctiggerf
sehrgut
bertheymans
SCoon
Home
/
Snippets
/
Convert Hex(or any base) string to Int
/
Comments
Convert Hex(or any base) string to Int
Snippet Menu
Revisions
Comments
Related Snippets
Add to Favorites
Email Snippet
Download Snippet
Print Snippet
Blog Snippet
snippet
|
revisions
|
comments
|
related
|
Add to Favorites
|
email
download
|
print
|
blog it
New Comment
I don't see how . . .
Mon. Oct. 9th, 2006 10:34 AM
sehrgut
. . . a single function call, right out of "$> man strtol" is a snippet. It's documentation, but it's not an item of creative work. qv.:
<manpage>
long
strtol(const char * restrict nptr, char ** restrict endptr, int base);
long long
strtoll(const char * restrict nptr, char ** restrict endptr, int base);
The strtol() function converts the string in nptr to a long value. The
strtoll() function converts the string in nptr to a long long value.
</manpage>
Oh, and here's my snippet for counting events:
I've got good news, and I've got bad news:
The universe is merely a figment of my imagination.
Now are you ready for the bad news?
int
i =
0
;
if
(
event
)
i++;
Reply
For what it's worth
Thu. Oct. 19th, 2006 10:55 AM
bobbyrward
I completely agree. But ask all the recent CS graduates how to convert a hex string to an int and listen to the answers you'll get. Sad but true.
Bobby R Ward
---------------------
bobbyrward@gmail.com
Reply
itoa()
Mon. Oct. 9th, 2006 6:19 AM
shell
You could also use itoa()
Reply
New Comment
<manpage>
long
strtol(const char * restrict nptr, char ** restrict endptr, int base);
long long
strtoll(const char * restrict nptr, char ** restrict endptr, int base);
The strtol() function converts the string in nptr to a long value. The
strtoll() function converts the string in nptr to a long long value.
</manpage>
Oh, and here's my snippet for counting events:
I've got good news, and I've got bad news:
The universe is merely a figment of my imagination.
Now are you ready for the bad news?
int i = 0;
if(event) i++;
Bobby R Ward
---------------------
bobbyrward@gmail.com