• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: error codes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: error codes
      • From: Bill Bumgarner <email@hidden>
References: 
 >error codes (From: Roland Silver <email@hidden>)

  • Prev by Date: error codes
  • Next by Date: Re: error codes
  • Previous by thread: error codes
  • Next by thread: Re: error codes
  • Index(es):
    • Date
    • Thread