Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const char* marp = move_as_root_path();
- pid_t pid = fork();
- if (pid == 0) {
- if (fds[1] != 1) {
- dup2(fds[1], 1);
- close(fds[1]);
- }
- close(fds[0]);
- execl(marp, marp, file_cstr, NULL);
- _exit(0);
- } else if (pid != -1) {
- close(fds[1]);
- char buf[1024];
- size_t actual_size;
- NSMutableData* data = [[NSMutableData alloc] init];
- while ((actual_size = read(fds[0], buf, 1024)) > 0)
- [data appendBytes:buf length:actual_size];
- close(fds[0]);
- file_content = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
- [data release];
- }
Add Comment
Please, Sign In to add comment