2.16: TQRCST

TOCGroup 1TQRBINTQOPENGroup 2A-ZGroup 1

READ-TRANSPARENT-DATA-FILE

Reads a thermodynamic data-file in transparent format.

Added for ChemApp version 4.0.0

Synopsis

FORTRAN: CALL TQRCST(NOERR)

C: tqrcst(&noerr);

Pascal: tqrcst(noerr);

Basic: Call tqrcst(noerr)


Name Type Value set on call or returned
NOERR INTEGER Returns an error number

TQRCST must be used to read a thermodynamic data-file in transparent format. Transparent data-files are usually either supplied by GTT-Technologies directly, or created using other software programs (e.g. FactSage).

The thermodynamic data-file to be read must be opened in the application program using default unit 10 (see Table 6), unless this has been changed using TQCIO.

For both FORTRAN and non-FORTRAN programs, TQOPNT and TQCLOS have to be used for opening and closing the data-file.

If the data-file to load is in ASCII (i.e. plain text) format, use TQRFIL instead; if it is in binary format, use TQRBIN.

See also

TQOPNT, TQCLOS, Chapter 1.11, TQGTRH

Examples

FORTRAN:View plain source code



C Read a thermochemical data-file in TRANSPARENT format, then C retrieves information on the transparent file header.
C NOTE: This example program requires a data-file in transparent format C to run, which is not part of a regular distribution of ChemApp C or ChemApp "light".
C The support function STRLEN returns the total number of characters in C a string, not counting trailing blanks INTEGER FUNCTION STRLEN(INSTR) CHARACTER INSTR*(*)
STRLEN = LEN(INSTR) DO WHILE(INSTR(STRLEN:STRLEN) .EQ. ' ') STRLEN = STRLEN - 1 IF (STRLEN .EQ. 1) RETURN ENDDO RETURN END

PROGRAM CAF31 IMPLICIT NONE
INTEGER NOERR, STRLEN
C Variables to store information from various transparent file C header (TFH) fields CHARACTER TFHID*255, TFHUSR*80,TFHNWP*40,TFHNRP*40,TFHREM*80 INTEGER TFHVER, TFHVNW(3), TFHVNR(3), TFHDTC(6), TFHDTE(6)

10 FORMAT(1X,A,I4.4,5(A1,I2.2))
C Initialise ChemApp CALL TQINI(NOERR)
C Open transparent data-file for reading. CALL TQOPNT('cosiex.cst', 10, NOERR)
C Read data-file CALL TQRCST(NOERR)
C Close data-file CALL TQCLOS(10, NOERR)
C Once the transparent data-file has been read, information on its C header can be retrieved. CALL TQGTRH(TFHVER, TFHNWP, TFHVNW, TFHNRP, TFHVNR, TFHDTC, * TFHDTE, TFHID, TFHUSR, TFHREM, NOERR)
WRITE(UNIT=*, FMT=*) 'Version number of the transparent file ' // * 'header format:', TFHVER WRITE(UNIT=*, FMT=*) 'Name of the program which wrote the ' // * 'data-file: ', TFHNWP(1:STRLEN(TFHNWP)) WRITE(UNIT=*, FMT=*) 'Version number of the writing program: ', * TFHVNW(1), '.', TFHVNW(2), '.', TFHVNW(3) WRITE(UNIT=*, FMT=*) 'Programs which are permitted to read ' // * 'the data-file: ', TFHNRP(1:STRLEN(TFHNRP)) WRITE(UNIT=*, FMT=*) 'Min. version number of the reading ' // * 'program: ', TFHVNR(1), '.', TFHVNR(2), '.', TFHVNR(3) WRITE(UNIT=*, FMT=10) 'File was created on ', * TFHDTC(1),'/', TFHDTC(2),'/',TFHDTC(3),' ', * TFHDTC(4),':',TFHDTC(5),':',TFHDTC(6) WRITE(UNIT=*, FMT=10) 'File will expire on ', * TFHDTE(1),'/', TFHDTE(2),'/',TFHDTE(3),' ', * TFHDTE(4),':',TFHDTE(5),':',TFHDTE(6) WRITE(UNIT=*, FMT=*) 'Licensee''s user ID(s): ', * TFHID(1:STRLEN(TFHID)) WRITE(UNIT=*, FMT=*) 'Licensee''s name: ', * TFHUSR(1:STRLEN(TFHUSR)) WRITE(UNIT=*, FMT=*) 'Remarks: ', * TFHREM(1:STRLEN(TFHREM))

Output:
 Version number of the transparent file header format: 1
 Name of the program which wrote the data-file: FactSage
 Version number of the writing program:  5. 0. 0
 Programs which are permitted to read the data-file: CAFU,CALI
 Min. version number of the reading program:  -1. -1. -1
 File was created on 2003/06/05 12:11:39
 File will expire on 2036/12/31 12:00:00
 Licensee's user ID(s): ????
 Licensee's name: GTT - Technologies
 Remarks: For use with ChemApp example programs

END


C:View plain source code




/* Program cac31 */ /* Read a thermochemical data-file in TRANSPARENT format, then retrieves information on the transparent file header. */
/* NOTE: This example program requires a data-file in transparent format to run, which is not part of a regular distribution of ChemApp or ChemApp "light". */
#include "cacint.h"
int main() { LI noerr;
/* Variables to store information from various transparent file header (TFH) fields */ char tfhid[255], tfhusr[80],tfhnwp[40],tfhnrp[40],tfhrem[80]; LI tfhver, tfhvnw[3], tfhvnr[3], tfhdtc[6], tfhdte[6];
/* Initialise ChemApp */ tqini(&noerr);
/* Note that tqopnt is used to open the thermochemical data-file, instead of a standard C library routine like fopen. The reason is that it is necessary to associate the data-file with a particular FORTRAN unit number (10 by default, see tqgio) so that the FORTRAN subroutine tqrcst can read from the correct file */ tqopnt("cosiex.cst",10,&noerr);
/* Read data-file */ tqrcst(&noerr);
/* Close data-file */ /* Again, the routine for closing the data-file is not a standard C library routine like fclose, but a special one to make sure the file that was previously opened under the unit number specified is closed. */ tqclos(10,&noerr);
/* Once the transparent data-file has been read, information on its header can be retrieved.*/ tqgtrh(&tfhver, tfhnwp, tfhvnw, tfhnrp, tfhvnr, tfhdtc, tfhdte, tfhid, tfhusr, tfhrem, &noerr);
printf("Version number of the transparent file header format: %li\n", tfhver); printf("Name of the program which wrote the data-file: %s\n", tfhnwp); printf("Version number of the writing program: %li.%li.%li\n", tfhvnw[0],tfhvnw[1],tfhvnw[2]); printf("Programs which are permitted to read the data-file: %s\n", tfhnrp); printf("Min. version number of the reading program: %li.%li.%li\n", tfhvnr[0],tfhvnr[1],tfhvnr[2]); printf("File was created on %li/%02li/%02li %02li:%02li:%02li \n", tfhdtc[0],tfhdtc[1],tfhdtc[2],tfhdtc[3],tfhdtc[4],tfhdtc[5]); printf("File will expire on %li/%02li/%02li %02li:%02li:%02li \n", tfhdte[0],tfhdte[1],tfhdte[2],tfhdte[3],tfhdte[4],tfhdte[5]); printf("Licensee's user ID(s): %s\n", tfhid); printf("Licensee's name: %s\n", tfhusr); printf("Remarks : %s\n", tfhrem);

Output:
Version number of the transparent file header format: 1
Name of the program which wrote the data-file: FactSage
Version number of the writing program: 5.0.0
Programs which are permitted to read the data-file: CAFU,CALI
Min. version number of the reading program: -1.-1.-1
File was created on 2003/06/05 12:11:39 
File will expire on 2036/12/31 12:00:00 
Licensee's user ID(s): ????
Licensee's name: GTT - Technologies
Remarks : For use with ChemApp example programs

return 0;
}


ChemApp Programmer's Manual, Edition 3.6© GTT-Technologies, 2003