mmap for write under MacOSX 10.8.2 with XCode 4.6 will make program crash
问题 I try to run a simple test of mmap under MacOSX 10.8.2, with XCode 4.6. This program is as follows, the file mapped for read is OK while the access to the write pointer "target" will make the program crash. Error message is "EXC_BAD_ACCESS". Does anyone have the same case with me ? Thanks a lot. #include <stdio.h> #include <string.h> #include <sys/mman.h> #include <fcntl.h> #include <unistd.h> int main(int argc, const char * argv[]) { int input, output; size_t size; char *source, *target;