1: #include <stdio.h>
2: #include <string.h>
3: #include <unistd.h>
4: #include <fcntl.h>
5: #include <aitio.h>
6:
7:
8: int
9: main(int argc, char **argv)
10: {
11: int f, ret;
12: char buf[BUFSIZ];
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:
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:
30: close(f);
31: return 0;
32: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>