Word Addressable I/O

 

FORTRAN example of use

      PROGRAM XXX
	
      INTEGER FNOM, IERR, BUF(1000)
C     ASSOCIATION OF UNIT 12 TO FILE 'XYZ'
      IERR = FNOM(12,'XYZ','RND',0)
C     OPENING THE FILE
      CALL WAOPEN(12)
C     SOME READING
      CALL WAREAD(12,BUF,81,1)
      IERR = WAREAD2(12,BUF(100),17,100)
      IF(IERR.NE.100) THEN
          PRINT *,'ERROR IN READING.'
      ENDIF
C     WRITING TO THE FILE
      CALL WAWRIT(12,BUF,200,1)
      IERR = WAWRIT2(12,BUF(100),201,100)
      IF(IERR.NE.100) THEN
         PRINT *,'ERROR IN WRITING.'
      ENDIF	
C     CLOSING THE FILE
      CALL WACLOS(12)
      IERR = FCLOS(12) 	
      STOP
      END
 

C example of use

     main()
     {
     int c_fnom(), ierr;
     int BUF[1000];
     /* connecting unit 12 to the file xyz */
     ierr = c_fnom(12,'xyz','RND',0);
     /* opening the file */
     c_waopen(12);
     /* reading */
     c_waread(12,&BUF,81,1);
     ierr=c_waread2(12,&BUF[99],17,100);
     if(ierr!=100)
     {
        printf("Error in reading");
        exit(-1);
     }	
     /* writing */
     c_wawrit(12,&BUF,200,1);
     /* closing the file */
     c_waclos(12);
     ier=fclos(12);	
     exit(0);
     }
 

AUTHOR

Mario Lépine - RPN
 

NOTES

Warning: Do not mix different I/O access to the same file (ex: writda, wawrit).
Buffering configuration can be controlled via the WA_CONFIG environment variable for performance issue.
 

SEE ALSO

( waopen, wawrit, waread, waclos)