Annotation of libaitio/example/test_aio.c, revision 1.1.2.2
1.1.2.1 misho 1: #include <stdio.h>
1.1.2.2 ! misho 2: #include <string.h>
1.1.2.1 misho 3: #include <unistd.h>
4: #include <fcntl.h>
5: #include <aitio.h>
6:
7:
8: int
9: main(int argc, char **argv)
10: {
1.1.2.2 ! misho 11: int f, ret;
! 12: char buf[BUFSIZ];
1.1.2.1 misho 13:
14: f = open("test_aio.dat", O_CREAT | O_RDWR | O_TRUNC, 0644);
15: if (f == -1) {
16: perror("open");
17: return 1;
18: }
19:
1.1.2.2 ! misho 20: while (!feof(stdin)) {
! 21: memset(buf, 0, sizeof buf);
! 22: fgets(buf, sizeof buf, stdin);
! 23: printf("io_write=%d\n", (ret = io_write(f, buf, strlen(buf))));
! 24: if (ret == -1) {
! 25: ioLIBERR(io);
! 26: return 2;
! 27: }
! 28: }
! 29:
1.1.2.1 misho 30: close(f);
31: return 0;
32: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>