Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void print_content(char* name){
- char c;
- char buffer[BUFFER_SIZE];
- struct aiocb my_aio;
- int file, nread;
- printf("Print content? [y/n]: ");
- c = getchar();
- if(c == 'y'){
- file = open(name, O_RDONLY);
- memset(&my_aio, 0, sizeof(struct aiocb));
- my_aio.aio_nbytes = BUFFER_SIZE;
- my_aio.aio_fildes = file;
- my_aio.aio_offset = 0;
- my_aio.aio_buf = buffer;
- aio_read(&my_aio);
- while(aio_error(&my_aio) == EINPROGRESS){
- }
- printf("%s", (char*)my_aio.aio_buf);
- close(file);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement