/* a sample program that read two strings  of length 20 from a file */
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/uio.h>

int main() {
    struct iovec iov[2];
    int iovcnt = 2;
    int fd1,i;
    char string1[20];
    char string2[20];
    
    if((fd1=open("readv.c",O_RDWR))==-1){
      printf("Cannot open file.\n");
      exit(1);
    }
    iov[0].iov_base = string1;
    iov[0].iov_len  = 20;
    iov[1].iov_base = string2;
    iov[1].iov_len  = 20;
    readv(fd1,iov,iovcnt);
    for(i = 0;i<2;i++) {
        printf(iov[i].iov_base);
        printf("\n");
    }
    close(fd1);
}



        
