Message base with QBasic
Message base with QBasic
(OP)
I am working on an old BBS program (my own) on an old 80's computer that is accessible via Telnet.
I need to write a message base to store messages in a file, maybe titles, to, from, date, msg # in another file.
I want it to be able to delete messages say once a board hit's 30 messages it deletes the old message.
I have not figured out how to do this in Qbasic yet. Does anyone have anything i can use maybe a message base already done that I can modify for my use or can help me get this done?
You will get credit on the BBS for the coding.
I need to write a message base to store messages in a file, maybe titles, to, from, date, msg # in another file.
I want it to be able to delete messages say once a board hit's 30 messages it deletes the old message.
I have not figured out how to do this in Qbasic yet. Does anyone have anything i can use maybe a message base already done that I can modify for my use or can help me get this done?
You will get credit on the BBS for the coding.
RE: Message base with QBasic
TYPE myRecord
name AS STRING * 20
age AS INTEGER
sex AS STRING * 1
END TYPE
DIM r AS myRecord
;Writing
r.name = "Jeff"
r.age = 30
r.sex = "m"
OPEN "file.txt" FOR RANDOM AS #1
PUT #1, <record_number>, r ;not providing a record number increments the file pointer automatically. Although, one should be provided if able.
CLOSE #1
;Reading
OPEN "file.txt" FOR RANDOM AS #1
GET #1, <record_number>, r ;not providing a record number increments the file pointer automatically. Although, one should be provided if able.
CLOSE #1
PRINT "name: ", r.name
PRINT "age: ", r.age
PRINT "sex: ", r.sex
-Geates
http://ns7.webmasters.com/caspdoc/html/vbscript_la...
RE: Message base with QBasic
Would this code delete the oldest message once the messages past #30 in count?
RE: Message base with QBasic
whenever you put a record (put #1,cr)increment the current record cr=cr+1
if cr=31 then make cr=1
this is a rotating storage, once the queue is filled the oldest scrolls off on next put
Nothing mentioned yet of how you want to read the messages, either bulk or singly.
Ed Fair
Give the wrong symptoms, get the wrong solutions.
RE: Message base with QBasic
CODE
-Geates
PS. I haven't programmed in qbasic for at least 5 years so there may be mistakes.
http://ns7.webmasters.com/caspdoc/html/vbscript_la...
RE: Message base with QBasic
numRecords = LOF(1) / LEN(myRecord)
-Geates
http://ns7.webmasters.com/caspdoc/html/vbscript_la...
RE: Message base with QBasic
May have Q mixed up with GW but recall LSET as the transfer method.
Ed Fair
Give the wrong symptoms, get the wrong solutions.