#include <unistd.h>1#include <stdio.h>2#include <stdlib.h>34#define BUF_SIZE 12856int main( int argc, char *argv[] ) {7int fd_stdout;8int fd_in;9char buf[BUF_SIZE];10int nread;1112(void)argc;13(void)argv;1415//attempt to open stdout16fd_stdout = open( "con:", O_WRONLY );17if( fd_stdout == -1 )18return -1;1920//attempt to open input file21fd_in = open( "/hello.txt", O_RDONLY );22if( fd_in == -1 ) {23close( fd_stdout );24return -1;25}2627//read and output to stdout28while( ( nread = read( fd_in, buf, sizeof( buf ) ) ) > 0 )29write( fd_stdout, buf, nread );3031//close the files32close( fd_in );33close( fd_stdout );3435return 0;36}373839