Search code examples
objective-cmacoshexdump

Creating hex dump in Objective-C


I want to create a hex dump of a binary file in Mac OS X.

In all apps in Mac OS, when you navigate to /Contents/Resources/, there is a file (or more) with the same name as the app.

I want to write an application in Objective-C that can read that file and convert it to some kind of a hex dump, like terminal's hexdump.

Does anybody know a way to create such a hex dump using Objective-C? (or perhaps an open source hex editor, written in objective-c?)

Thanks in advance.


Solution

  • Use NSData to read the file as raw data, then display the bytes however you want (for example, using a format string).