ACQ2XX_API
dumptest.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <errno.h>
00003 
00004 #include <sys/types.h>
00005 #include <sys/stat.h>
00006 #include <fcntl.h>
00007 #include <unistd.h>
00008 
00009 int main(int argc, char* argv[])
00010 {
00011         char buf[80];
00012         int fd = open(argv[1], O_RDONLY);
00013         int rc;
00014 
00015         if (fd < 0){
00016                 fprintf(stderr, "ERROR failed to open %s\n", argv[1]);
00017                 return errno;
00018         }
00019 
00020         while((rc = read(fd, buf, 80)) >= 0){
00021                 if (rc == 0){
00022                         printf("return 0\n");
00023                         sleep(1);
00024                 }else{
00025                         printf("%d\n", rc);
00026                 }
00027         }
00028 
00029         printf("ERROR: rc %d errno %d\n", rc, errno);
00030         perror("xxx");
00031         return errno;
00032 }