version 1.1.2.1, 2012/08/01 09:20:04
|
version 1.1.2.2, 2012/08/01 09:26:06
|
Line 1
|
Line 1
|
#include <stdio.h> |
#include <stdio.h> |
|
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
#include <fcntl.h> |
#include <fcntl.h> |
#include <aitio.h> |
#include <aitio.h> |
Line 7
|
Line 8
|
int |
int |
main(int argc, char **argv) |
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); |
f = open("test_aio.dat", O_CREAT | O_RDWR | O_TRUNC, 0644); |
if (f == -1) { |
if (f == -1) { |
perror("open"); |
perror("open"); |
return 1; |
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); |
close(f); |