Re: error codes
Re: error codes
- Subject: Re: error codes
- From: "Kyle Sluder" <email@hidden>
- Date: Sat, 23 Aug 2008 14:44:00 -0400
On Sat, Aug 23, 2008 at 2:09 PM, Roland Silver <email@hidden> wrote:
> Is there a convenience function (or method) foo() with int arg and NSString*
> value for converting an error code to a string?
This program:
#include <stdio.h>
int main(int argc, char **argv)
{
int a = 560227702;
char *b = (char*)(&a);
printf("%c%c%c%c%c", b[0], b[1], b[2], b[3], b[4]);
return 0;
}
Produces this output:
$ ./a.out
ved!?
It's close... dunno what magic is going on, but it shouldn't be that
hard to do yourself. What bothers me is that you have a five
character error code ("!idev") whereas an int is only 4 bytes wide. I
wrote my code with 5 characters, but it's an obvious out-of-bounds
access.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >error codes (From: Roland Silver <email@hidden>) |