Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

64-bit integers

Status
Not open for further replies.

boebox

MIS
Oct 30, 2000
70
CA
I am trying to do a simple division with a llu, but it is not working???? I keep on getting 0 as the %d value in the second printf statment.

main(void)
{

printf("RLIM_INFINITY as unsigned %u = %d MB\n",
RLIM_INFINITY, RLIM_INFINITY/(1024*1024));

printf("RLIM_INFINITY as unsigned long long %llu = %d MB\n",
RLIM_INFINITY, RLIM_INFINITY/(1024*1024));

printf("RLIM_INFINITY as hex %x\n",
RLIM_INFINITY);

printf("RLIM_INFINITY as long long hex %llx\n",
RLIM_INFINITY);

printf("\\n");

return 0;
}

Any help would be appreciated.

-Tony
 
Just a guess but i dont think %d cant handle more then a 32 bit integer. I belive you may have to write your own function that writes the value to a string and use %s.

Matt
 
Zyrentian is correct-

To handle this, most compilers will support "%ld" and many will also
support "%lld" for LONG and LONG LONG integers.
[3eyes]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top