Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6574963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:19:44+00:00 2026-05-25T15:19:44+00:00

Many/most OSStatus values on iPhone are 4-character displayable values jammed into the 4-byte int.

  • 0

Many/most OSStatus values on iPhone are 4-character displayable values jammed into the 4-byte int. In order to make the values displayable in a hex dump on a little-endian system, the bytes are in reverse order in memory, such that simply copying them to a buffer with memcpy and tagging a null on the end doesn’t produce the desired result.

Does anyone have a clever way to swap the bytes around and get them into a character string in a relatively small number of (source code) keystrokes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:19:45+00:00Added an answer on May 25, 2026 at 3:19 pm

    Wanting to minimize the amount of coding required (since this is diagnostic/debug code that needs to be kept simple) I opted for a C function that returns an NSString:

    NSString* statToString(UInt32 source) {
        char buf[4];
        char* sourceView = (char*) &source;
        buf[0] = sourceView[3];
        buf[1] = sourceView[2];
        buf[2] = sourceView[1];
        buf[3] = sourceView[0];
        return [[[NSString alloc] initWithBytes:buf length:4 encoding:NSUTF8StringEncoding] autorelease];
    }
    

    This allows the function to be used directly in an NSLog parameter list, eg, without the need to declare any temps.

    Probably could tighten it up by using one of the swab variants, but that level of optimization isn’t necessary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many tables that use Lookup/Enum references for most of their column values.
I'm inserting many dates into a database. Most of them write normally, so that
Many (most?) sites aiming for accessibility and standards compliance use unordered lists for their
as many of you most likly know Flash CS4 intergrates with the GPU. My
I have a xml that has so many elements and most of that contain
I'm doing an insert query where most of many columns would need to be
This is something that's been bugging me for many years: why most online services
What is the most efficient way to determine how many comments a particular blog
What is the most elegant way (in C#) of determining how many pages of
I've found many definitions of the 'var' statement but most of them are incomplete

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.