cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Writing Output to Integer Variable in C++

From: codemastr <codemstr_at_ptd.net>
Date: Wed, 22 Dec 2004 12:38:50 -0500

----- Original Message -----
From: "Chris Morbitzer" <gamephreak_at_gmail.com>
To: <curl-library_at_cool.haxx.se>
Sent: Tuesday, December 21, 2004 10:40 PM
Subject: Writing Output to Integer Variable in C++

>I want to write the output of a Curl call to a PHP file to an integer,
> but it's too large for even a long long integer! Right now I am
> saying:
> int feed = atoi(chunk.memory);
> This doesn't work, though, because the number that is outputted is 225
> digits long! What can I do?

PHP doesn't support integers of that size, so I have no idea what the issue
is. PHP uses the same size as a long integer on your system. You can test
this quite easily, in PHP do, printf("%u\n", ~0);, on my system it prints
4294967295, the maximum unsigned value for a 32bit integer. It clearly does
not give me a 225 digit number. So if you have a 225 digit number in PHP,
it's a string, not a numeric. Therefore, store it as a string in C++ as
well.

-- codemastr
Received on 2004-12-22