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 Foundation | |
// Open the Mach-O binary file | |
let path = "myprogram" | |
let file = fopen(path, "r") | |
// Read the Mach-O header | |
var header = mach_header() | |
fread(&header, MemoryLayout.size(ofValue: header), 1, file) |