/* * include needed system headers */ #include /* include standard i/o library */ #include /* include standard library */ #include /* include string library */ #include /* include unix standard library */ #include /* */ #include /* */ #include /* */ #include /* error simbol definitions */ #include /* system time definitions */ #include /* math library */ void readtrailer_(unsigned short *trailer, int *error, int *fd) { int nread; int i; unsigned short word; *error=0; /*** read the buffer ***/ nread=read(*fd, trailer, 2*3);//il trailer e' lungo 6 parole da 8 bits if( nread==0 ) { printf("readtrailer: Unexpected end of file %d at %d \n",*fd,nread); *error=1; return ; } if ( nread != 6) { printf("readtrailer: Error on reading: nread = %d \n",nread); *error=-1; return ; } /*** correct byte ***/ //endianess... for(i=0; i<3; i++) { word = trailer[i]; trailer[i] = ( (word&0x00ff) << 8 ) | ( (word&0xff00) >> 8 ); } // for( i=0; i<3; i++) printf("%x \n",trailer[i]);//??? return; }