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.
Hex Fiend is embeddable, if it's an editor that you're after.
Use NSData to read the file as raw data, then display the bytes however you want (for example, using a format string).
Related
I'm new to sdr, dsp, and GNU Radio. My goal is to create an FSK demodulator for a project at work (described in this question), but since I haven't been making progress, I'm trying to teach myself some of the basics.
For practice, I'm trying to set up a GNU Radio flowchart that reads a text file, modulates it, then demodulates it, returning the same text as output.
Basic question: is it possible to read a text file, mod/demod, then return plain, readable text using GNU Radio? I'm trying to send and receive something simple, like "Test, one two three."
Next question: if the above is possible, where am I going wrong in the following flowchart (the output file has size (~200 kb), but appears blank)?
Thanks for any advice!
The file sink acts as a giant buffer for the data type that you choose.
To output a readable text, I chose to use a byte file sink and convert the binary data to ASCII/UTF-8 values ie add 48 to the stream.
I want to create a file type that contains objective c code and image data. But I want it not readable by a text editor. How best do I do this?
Assuming you already know how to append the code and the image in a file (which, however, should be a pretty easy task), you just need to crypt the data before storing. You can easily do it using, i.e., AES encryption.
I want to be able to put a file to a variable so I can interact with it. For example I could put a wav file into a variable and play it back without having to distribute the separate file. Is this possible for instance by using Base64. I have seen some Python programs for example that have images embedded in the code.
Yes, you could conceivably store the contents of a binary .wav file as a static, uuencoded text array.
Probably a better way to go about it would be to create a "resource" for your binary data:
http://msdn.microsoft.com/en-us/library/xbx3z216.aspx
I'm trying to upload a compiled program to a microcontroller.. well my problem is not in programming or uploading things.. my problem is what to upload u.u
The program is in C and was compiled with SDCC.
The mcu is an AT89S8252 by ATMEL.
I built a simple parallel port programmer following MCU protocols for serial programming as stated in its datasheet.
So far so good.. but.. what shoud I upload to the mcu??
when compiling, SDCC generates a lot of text reports.. and then an .ihx.. I suspect I should not upload this file directly but post-process it in some way to get the actual raw bytes to upload??
any help will be highly appreciated =)
Is the .ihx file an Intel hex format file by any chance ? If it is you don't have too much more work to do before you can put your programmer to work. Intel hex format is just a specialized text format. Google Intel hex format to find what it looks like. There's a page on Wikipedia for example. Compare that to your .ihx file. If you get a match you should be able to find something to convert it to a raw binary format, ready to push down to your MCU. If you can't, you should be able to write something to do the job in an hour or so, it's very simple. I could possibly email you a tool I have written previously if you are really stuck. Good luck.
Your .ihx file is an Intel hex file I reckon. That, or the similar Motorola S-record format, is usually a good format for programmer software to read. Those formats contain the data to program, as well as the address that the data should be written to. It is more useful than a binary file, which contains no address information.
What software are you using to drive the parallel programmer, and does it accept Intel hex format or Motorola S-record files? Or, do you mean you're writing your own?
You can open an Intel hex file in a text editor and make some sense of its contents. There are many references that explain the format. E.g. Intel HEX in Wikipedia.
Is there any way to (easily) modify a string in a Mach-O binary? I want to extend the length of a pre-existing string.
https://sourceforge.net/projects/machoview
Extending the string will not be an easy task with manual editing, but at least you can get a picture about the Mach-O file structure.
This will not be an easy procedure, you cannot just go and change a string in textedit and hope it works because mach-o binaries work with encoded bytes and if 1 byte is out of order, the binary will not be executed properly. If you really wish to modify a string inside a fully assembled mach-o binary file without disrupting its delicate code you will need lots of knowledge and understanding of how mach binaries work. You will need to be able to modify it in single bytes and replacing its encoded numbers and offsets. Hopper for Mac might be able to help you understand the architecture of a mach-o binary. but if you need to replace a string with a different string with the exact same length, you might be able to simply replace its bytes so that the binary still reads it at the same length. but you will need a hexadecimal modifying application to do that.