ILE C Record I⁄O

If you use ILE C record I⁄O in your program, you must:
  • Use the ILE C record I⁄O functions (for example, functions that begin with _R)
  • Use the _RFILE data type.
The example in Figure 1 can be rewritten as follows:
Figure 1. Example: Using ILE C Record I/O
#include <stdio.h>
#include <recio.h>
#define MAX_LEN 80
int main(void)
{
  _RFILE *fp;
  _RIOFB_T *iofb;
  char buf[MAX_LEN + 1];
  fp = _Ropen("MY_LIB/MY_FILE", "rr");
  iofb =_Rreadn(fp, buf, MAX_LEN, __DFT);
  while ( iofb->num_bytes != EOF )
  {
    buf[iofb->num_bytes] = '\0';
    printf("%s\n", buf);
    iofb =_Rreadn(fp, buf, MAX_LEN, __DFT);
  }
  _Rclose(fp);
  return 0;
}