home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beijing Paradise BBS Backup
/
PARADISE.ISO
/
software
/
BBSDOORW
/
EZY110-1.ARJ
/
STRUCT.ARJ
/
CLIB.ARJ
/
LASTREAD.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-28
|
1KB
|
33 lines
#include <ezycom.h>
#include <ezylib.h>
#include <stdio.h>
// UserRecord is 0 based
// MsgBoard is 1 based
// MsgNumber is 1 based
word GetNextRead(FILE *hLastComb,word UserRecord,word MsgBoard)
{
word NextRead;
fseek(hLastComb,(((longint)UserRecord * (longint)(Constant.MaxMess / 16)) +
(longint)((MsgBoard - 1) / 16)) * sizeof(UsersLastRecord) +
(longint)(((MsgBoard - 1) % 16) * 2) + 2,SEEK_SET);
if (fread(&NextRead,sizeof(word),1,hLastComb) == 0)
NextRead = 0;
return(NextRead);
}
int PutNextRead(FILE *hLastComb,word UserRecord,word MsgBoard,word MsgNumber)
{
int Success = FALSE;
if ((MsgBoard <= Constant.MaxMess) && (MsgBoard > 0)) {
fseek(hLastComb,(((longint)UserRecord * (longint)(Constant.MaxMess / 16)) +
(longint)((MsgBoard - 1) / 16)) * (longint)sizeof(UsersLastRecord) +
(longint)(((MsgBoard - 1) % 16) * 2) + 2,SEEK_SET);
if (fwrite(&MsgNumber,sizeof(word),1,hLastComb) == 1)
Success = TRUE;
}
return(Success);
}