When I read standard input to print to standard output & press ctrl+d to terminate putting in input, read() returns -1. I thought that ctrl+d meant the end of a file, and hence, would return a 0. I'm unsure as to why it is returning -1 (error). I included a snippet of my code, and if this is not enough, I will post more. Thanks for the help in advance.    
for(int i = 1; i < argc; i++) {
         int filedes = open(argv[i], O_RDONLY);
          if(argv[i][0]  == '-'){
          while((n=read(0,buf,BUFFSIZE))>0){
            write(1,buf,n);
            }
          //      close(0);                                                                    
          //       close(filedes);                                                             
            }
 
    