rdenci |
Table of contents
ProcedureRDENCI ( Read encoded integers from text file ) SUBROUTINE RDENCI ( UNIT, N, DATA ) AbstractRead N encoded integers from a text file, decoding them into their equivalent integers. Required_ReadingNone. KeywordsCONVERSION NUMBERS UTILITY DeclarationsIMPLICIT NONE INTEGER UNIT INTEGER N INTEGER DATA(*) Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- UNIT I Fortran unit number of input text file. N I Number of integers to read and decode. DATA O List of decoded integers. Detailed_InputUNIT is the Fortran unit number for a previously opened text file. All reading will begin at the CURRENT POSITION in the text file. N is the number of encoded integers to be read from the text file attached to UNIT. Detailed_OutputDATA is the list of decoded integers read from the text file attached to UNIT. ParametersNone. Exceptions1) If N, the number of data items, is not positive, the error SPICE(INVALIDARGUMENT) is signaled. 2) If an error occurs while reading from the text file attached to UNIT, the error SPICE(FILEREADFAILED) is signaled. 3) If an error occurs while decoding a number, the error SPICE(DECODINGERROR) is signaled. FilesSee the description of UNIT in $Detailed_Input. ParticularsThis routine will read N encoded integers beginning at the current position in a previously opened text file. The current position in a file is defined to be the text line immediately following the last text line that was written or read. The integers will be decoded and placed into a list of integers which will be passed back to the caller. The encoded integers are represented as quoted character strings so that a Fortran list directed read may be used to read the encoded values, rather than a formatted read with the format specifier FMT = '(A)'. This routine is one of a pair of routines which are used to encode and decode integers: WRENCI -- Encode and write integers to a file. RDENCI -- Read and decode integers from a file. The encoding/decoding of integers is performed to provide a portable means for transferring data values. Currently the encoded integers are represented as signed hexadecimal numbers See INT2HX.FOR and HX2INT.FOR for details. ExamplesSuppose we have the following input file which contains the values 1 - 100 encoded, and that the input file has already been opened for reading. The arrow, '-->', indicates the current position in the file. -->'1' '2' '3' '4' '5' '6' '7' '8' '9' 'A' 'B' 'C' 'D' 'E' 'F' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '1A' '1B' '1C' '1D' '1E' '1F' '20' '21' '22' '23' '24' '25' '26' '27' '28' '29' '2A' '2B' '2C' '2D' '2E' '2F' '30' '31' '32' '33' '34' '35' '36' '37' '38' '39' '3A' '3B' '3C' '3D' '3E' '3F' '40' '41' '42' '43' '44' '45' '46' '47' '48' '49' '4A' '4B' '4C' '4D' '4E' '4F' '50' '51' '52' '53' '54' '55' '56' '57' '58' '59' '5A' '5B' '5C' '5D' '5E' '5F' '60' '61' '62' '63' '64' Then, the following code fragment would read and decode these 100 values. N = 100 CALL RDENCI( UNIT, N, DATA ) Upon returning, the array data would contain the values 1 - 100. RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) K.R. Gehringer (JPL) VersionSPICELIB Version 1.1.0, 03-JUN-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. Fixed I/O type of argument DATA in $Brief_I/O table. SPICELIB Version 1.0.0, 19-OCT-1992 (KRG) |
Fri Dec 31 18:36:41 2021