BBS: Inland Empire Archive
Date: 02-10-93 (12:09) Number: 308
From: CORIDON HENSHAW Refer#: NONE
To: ZACK JONES Recvd: NO
Subj: Nodelist reader (FINALLY! Conf: (2) Quik_Bas
Sunday February 07 1993, Zack Jones writes to Coridon Henshaw:
CH>> I've finally finished the below code for reading a Fido standard
CH>> nodelist. This could be easily modifyed to convert the nodelist to a
CH>> ISAM datafile.
ZJ> Alright! Some code! There's hope after all!
It's just a small portion of the stuff that I'll be posting
as I work on my mailer.
ZJ> One small gotcha though:
CH>> ON LOCAL ERROR GOTO HandleError
ZJ> No can do ON LOCAL ERROR in QB %^(.
Hmmm, the LOCAL ERROR was a fouled up attempt to prevent
OutArray() from going out of bounds.
PDS with near strings alows a program to write to a array
with a subscript BIGGER than the array size, overwriting
the stack. This bug ONLY shows itself up when a program is
compiled, QBX does catch it, and the only way to find it is
using codeview, ON ERROR doesn't even SEE it!!
Here's a little re-write that doesn't need LOCAL ERROR:
FUNCTION BreakString% (OutArray() AS STRING, InString AS STRING)
DIM Char AS STRING * 1
InString = RTRIM$(InString)
OutArrayPointer = 0
InStrLength = LEN(InString)
FOR Count& = 1 TO InStrLength
Char = MID$(InString, Count&, 1)
SELECT CASE Char
IF OutArrayPointer <= UBOUND(OutArray) THEN
OutArrayPointer = OutArrayPointer + 1
OutArray(OutArrayPointer)_ + " "
OutArray(OutArrayPointer)_ + Char
BreakString = OutArrayPointer
BreakString = 0
Coridon Henshaw \ Sirrus Software
--- GEcho 1.00
* Origin: TCS Concordia - Mail Only - Toronto, Ontario (1:250/820)