Created
June 25, 2012 01:03
-
-
Save jverkoey/2985830 to your computer and use it in GitHub Desktop.
Memory mapping in Objective-C
This file contains hidden or 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
const char* cstr = [string UTF8String]; | |
void* anon = mmap(0, sizeof(char) * (string.length + 1), PROT_WRITE|PROT_READ, MAP_ANON|MAP_PRIVATE, 0, 0); | |
if (anon == MAP_FAILED) { | |
NSLog(@"Failed to map memory."); | |
return; | |
} | |
strcpy(anon, cstr); | |
// How do I get a file descriptor for use here? | |
markdownin = fdopen(fd, "r"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://jverkoey.github.com/fmemopen/
Thanks gang!