Outputting an unsigned long long
Outputting an unsigned long long
- Subject: Outputting an unsigned long long
- From: Clark Mueller <email@hidden>
- Date: Thu, 20 Jun 2002 20:07:01 -0600
I am having a problem outputting an unsigned long long, and I am at a loss as to how to remedy the problem. I create an NSString using the ANSI formatters:
[NSString stringWithFormat:@"%.1f GB (%d bytes)", (float)totalPhysical/1024/1024/1024, (int)totalLogical]
The totalPhysical, when used as the float value, is always displayed correctly (as "x.x GB", so there is no problem with the actual size that is assigned to the variable. The problem seems to be when I am formatting the "%d bytes" part. This value is displayed correctly up to a certain point, after which it becomes unpredictable, and has become a negative value. I have not dealt with outputting an unsigned long long before; is there a special trick I should know?
Thanks,
Clark
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.