--- libaitio/example/test_aio.c 2012/08/01 09:20:04 1.1.2.1 +++ libaitio/example/test_aio.c 2012/08/01 09:26:06 1.1.2.2 @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -7,12 +8,23 @@ int main(int argc, char **argv) { - int f; + int f, ret; + char buf[BUFSIZ]; f = open("test_aio.dat", O_CREAT | O_RDWR | O_TRUNC, 0644); if (f == -1) { perror("open"); return 1; + } + + while (!feof(stdin)) { + memset(buf, 0, sizeof buf); + fgets(buf, sizeof buf, stdin); + printf("io_write=%d\n", (ret = io_write(f, buf, strlen(buf)))); + if (ret == -1) { + ioLIBERR(io); + return 2; + } } close(f);