Category : C Source Code
Archive   : TCISAM.ZIP
Filename : IREADN.C
* IREADN.C - read next
*
* Copyright (c) 1987, Jim Mischel
* Modifications:
*
* 08/13/87 - jim - original coding
*/
#include "inxdefs.h"
/*
* iread_next() - return the next record in sequence. The file must be
* started using istart() before this routine is called. If successful
* returns 0 with data record at destin. At end of file, EOF is returned.
* Any other errors return status. In the case of EOF or error, the data at
* destin is unchanged.
*
* This routine assumes there is enough space at 'dest' to store the entire
* data record.
*/
int iread_next(void *d, void *dest)
{
df_rec *db_control = (df_rec *)d;
char *destin = (char *)dest;
if (db_control->df_flags & DF_EOF)
return(EOF); /* already reached end of file */
/*
* if this is not the first read after starting the file, get the
* next index record into the buffer.
*/
if (!(db_control->df_flags & DF_START)) {
if (iget_next(db_control,&db_control->df_nxt_buff))
return(EOF);
memcpy(&db_control->df_nxt_buff,&db_control->df_inx_buff,sizeof(inx_rec));
}
else
db_control->df_flags &= ~DF_START; /* reset first read flag */
/* get the data record */
if (iread_dat(db_control,db_control->df_nxt_buff.if_dat_ptr))
return(ierrno);
db_control->df_flags &= ~DF_TOF; /* clear top-of-file flag */
db_control->df_flags &= ~DF_DELETE; /* clear deleted record flag */
/* copy the data record from data buffer into user's area */
memcpy(destin,db_control->df_dat_buff,db_control->df_rec_size);
return(0);
} /* iread_next */
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/