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
Hello Zack! 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: ===Chop=== 'NAME: PARSE.BAS DEFINT A-Z 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 CASE "," IF OutArrayPointer <= UBOUND(OutArray) THEN OutArrayPointer = OutArrayPointer + 1 ELSE GOTO HandleError ENDIF CASE "_" OutArray(OutArrayPointer) = OutArray(OutArrayPointer)_ + " " CASE ELSE OutArray(OutArrayPointer) = OutArray(OutArrayPointer)_ + Char END SELECT NEXT BreakString = OutArrayPointer EXIT FUNCTION HandleError: BreakString = 0 END FUNCTION ===Chop=== Coridon Henshaw \ Sirrus Software --- GEcho 1.00 * Origin: TCS Concordia - Mail Only - Toronto, Ontario (1:250/820)
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