QWK Routines...

 BBS: Inland Empire Archive
Date: 03-05-92 (15:40)             Number: 150
From: ARTHUR SHIPKOWSKI            Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: QWK Routines...                Conf: (11) Modula-2

The various parameters mean the same thing for both routines... REPHead/QWKHead is a QWKHeader. note: for REPWrite, MsgNum must contain the conference number. MsgTxt$ is the message text. ConfNum% is the conference number, -1 you use for personal messages. Start out w/-1, and MsgNum% = 0 and as you increase MsgNum, it will go through all the confences (cool huh?) MsgNum% is the message number Pth$ is the path to the uncompressed packet... .i.e "C:\MYREADER\WORK" BBSID$ is the bulletin board I.D. - the filename part of the packet, like in KNIGHT.QWK, KNIGHT ===================================CUT HERE========================== ' Code by Arthur Shipkowski ' released to Public Domain at 3-5-92 ' If you use this and distribute said program, or show it to others ' .i.e BBS door for your BBS, gimme a little credit, or your computer ' may explode. ;-) DEFINT A-Z TYPE QWKHeader StatFlag AS STRING * 1 MsgNum AS STRING * 7 MDate AS STRING * 8 MTime AS STRING * 5 MTo AS STRING * 25 MFrom AS STRING * 25 MSubject AS STRING * 25 MPassword AS STRING * 12 MRefNum AS STRING * 8 MBlocks AS STRING * 6 MActive AS STRING * 1 MConf AS STRING * 1 Filler AS STRING * 3 END TYPE SUB QWKRead (QWKHead AS QWKHeader,MsgTxt$,ConfNum%,MsgNum%,Pth$) IF ConfNum%=-1 THEN ConfNumS$="PERSONAL":GOTO OpenNDX ConfNumS$=STR$(ConfNum%) WHILE LEN(ConfNumS$)<3 ConfNumS$="0"+ConfnumS$ WEND OpenNDX: NDXF%=FREEFILE OPEN Pth$+ConfNumS$+".NDX" FOR BINARY AS NDXF% MultOf5%=MsgNum% * 5 IF MultOf5% > LOF(NDXF%)-5 THEN CLOSE NDXF% FindNextNDX: ConfNum%=ConfNum%+1 ConfNumS$=STR$(ConfNum%) WHILE LEN(ConfNumS$)<3 ConfNumS$="0"+ConfnumS$ WEND IF LEN(DIR$(ConfNumS$+".NDX") THEN MsgNum%=0:GOTO OpenNDX: GOTO FindNextNDX: END IF SEEK NDXF%,MultOf5% Record%=VAL(STR$(CVS(INPUT$(NDXF%,4)))) CLOSE NDXF% MsgF%=FREEFILE OPEN Pth$+"MESSAGES.DAT" FOR BINARY AS MsgF% SEEK MsgF%,Record%*128 GET MsgF%,,QWKHead NumOfBlocksToRead%=VAL(QWKHead.MBlocks) * 128 MsgTxt$=INPUT$(MsgF%,NumOfBlocksToRead%) WHILE INSTR(MsgTxt$,CHR$(227)) CutOff%=INSTR(MsgTxt$,CHR$(227)) MsgTxt$=LEFT$(MsgTxt$,CutOff%- 1)+CHR$(13)+CHR$(10)+RIGHT$(MsgTxt$,CutOff%+1) WEND CLOSE MsgF% END SUB SUB REPWrite (REPHead AS QWKHeader,MsgTxt$,BBSID$,Pth$) [STATIC] RepN%=FREEFILE OPEN Pth$+BBSID$+".MSG" FOR BINARY AS RepN% IF PacketExist% THEN GOTO PutPacket: PUT RepN%,,BBSID$+SPACE$(128-LEN(BBSID$)) PacketExist%=-1 CRLF$=CHR$(13)+CHR$(10) PutPacket: PUT RepN%,,REPHead WHILE INSTR(MsgTxt$,CRLF$) CutOff%=INSTR(MsgTxt$,CRLF$) MsgTxt$=LEFT$(MsgTxt$,CutOff%-1)+CHR$(227)+RIGHT$(MsgTxt$,CutOff%+2) WEND PUT RepN%,,MsgTxt$ CLOSE RepN% END SUB ================================END SNIPPETS========================= * JABBER v1.1 * WWhhaatt ddooeess FFUULLLL DDUUPPLLEEXX mmeeaann??
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET