-
-
Save tonycn/7566074 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <CoreFoundation/CoreFoundation.h> | |
#import <Foundation/Foundation.h> | |
NSString *NSStringFromOSStatus(OSStatus errCode) | |
{ | |
if (errCode == noErr) | |
return @"noErr"; | |
char message[5] = {0}; | |
*(UInt32*) message = CFSwapInt32HostToBig(errCode); | |
return [NSString stringWithCString:message encoding:NSASCIIStringEncoding]; | |
} | |
int main(int argc, const char *argv[]) { | |
NSLog(@"error stirng %@", NSStringFromOSStatus(560557684)); | |
return 0; | |
} | |
// compile | |
// clang -Wall -framework Foundation -framework CoreFoundation convert_osstatus.m -o convert_osstatus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment