void scrwrite_c(int handle,Const float *buffer,int offset,int length) /**scrwrite -- Write real data to the scratch file. */ /*:scratch-i/o */ /*+ FORTRAN call sequence: subroutine scrwrite(tno,buf,offset,length) integer tno,offset,length real buf(length) This writes real data to the scratch file. Input: tno The handle of the scratch file. offset The offset (measured in reals) into the scratch file to write. The first real has offset 0. length The number of reals to write. buf The data to write. */ /*-- */ /*----------------------------------------------------------------------*/ { int iostat; hwriteb_c(handle,(char *)buffer, (off64_t)sizeof(float)*offset,sizeof(float)*length,&iostat); if(iostat){ bug_c( 'w',"Error writing to scratch file"); bugno_c('f',iostat); } }
void scrread_c(int handle,float *buffer,int offset,int length) /**scrread -- Read real data from a scratch file. */ /*:scratch-i/o */ /*+ FORTRAN call sequence: subroutine scrread(tno,buf,offset,length) integer tno,offset,length real buf(length) This reads real data from the scratch file. Input: tno The handle of the scratch file. offset The offset (measured in reals) into the scratch file to read. The first real has offset 0. length The number of reals to read. Output: buf The returned data. */ /*-- */ /*----------------------------------------------------------------------*/ { int iostat; hreadb_c(handle,(char *)buffer, (off64_t)sizeof(float)*offset,sizeof(float)*length,&iostat); if(iostat){ bug_c( 'w',"Error reading from scratch file"); bugno_c('f',iostat); } }
void hisread_c(int tno,char *text,size_t length,int *eof) /** hisread -- Read a line of text from the history file. */ /*& pjt */ /*: header-i/o */ /*+ FORTRAN call sequence: subroutine hisread(tno,line,eof) integer tno character line*(*) logical eof This reads a line of text from the history file. Input: tno The handle of the input data set. Output: line The string to receive the read string. eof This logical variable turns true when the end of the history file is reached. */ /*-- */ /*----------------------------------------------------------------------*/ { int iostat; hreada_c(history[tno],text,length,&iostat); if(iostat == 0) *eof = FORT_FALSE; else if(iostat == -1) *eof = FORT_TRUE; else bugno_c('f',iostat); }
void scrclose_c(int handle) /**scrclose -- Close and delete a scratch file. */ /*:scratch-i/o */ /*+ FORTRAN call sequence: subroutine scrclose(tno) integer tno This closes and deletes a scratch file. The scratch file cannot be accessed again, after it is closed. Input: tno The handle of the scratch file. */ /*-- */ /*----------------------------------------------------------------------*/ { int iostat; hdaccess_c(handle,&iostat); if(iostat){ bug_c( 'w',"Error closing scratch file"); bugno_c('f',iostat); } }
void scropen_c(int *handle) /**scropen -- Open a scratch file. */ /*:scratch-i/o */ /*+ FORTRAN call sequence: subroutine scropen(tno) integer tno This opens a scratch file, and readies it for use. Output: tno The handle of the scratch file. */ /*-- */ /*----------------------------------------------------------------------*/ { int iostat; char name[32]; (void)sprintf(name,"scratch%d",number++); haccess_c(0,handle,name,"scratch",&iostat); if(iostat){ bug_c( 'w',"Error opening scratch file"); bugno_c('f',iostat); } }