Open System Services Programmer's Guide

/* The program can execute code while the read operation is being
completed by the system. */
for (i = 0; i < 100000; i++) ;
printf("Now issuing AWAITIOX to wait for I/O completion.\n");
/* AWAITIOX completes the READX operation. */
CC = AWAITIOX(&filenum, /* file number */
,
&bytesread, /* number of bytes read */
&request_tag, /* request tag */
);
/* If the condition code returned is not the one for success,
print a message and exit. */
if(_status_ne(CC)) { /* check the success condition code */
fprintf(stderr, "Awaitiox failed.\n");
exit(1);
}
printf("Bytes read = %d\n", bytesread);
/* Print out the first ten bytes in octal plus "string". */
printf("First 10 bytes read (in octal): ");
for (i = 0; i < 10; i++)
printf("%o ", buffer[i]);
printf("\n");
buffer[bytesread] = 0; /* make string NULL-terminated */
printf("\n%s\n", buffer);
return(0);
}
Example 22 shows the use of the Guardian FILE_OPEN_ and READX procedures to read data from
an OSS file whose name is provided as input to the program. This program waits for I/O operations
to terminate.
72 Managing Files