BBS: Inland Empire Archive Date: 07-26-92 (02:11) Number: 180 From: SUNNY HUGHES Refer#: NONE To: JEFFERY FOY Recvd: NO Subj: Re: Pds 7.1/Qb 4.5 Templa Conf: (2) Quik_Bas
JF> Perhaps 'template' was the wrong word to use. I'd like to see a non- JF> trivial program written in basic to get an idea of the general structure JF> of a basic program. (i.e. so my programs won't look so sloppy) If your using QB, you can get a decent enough idea of structuring by going through the on-line help and there is a section under the contents I believe, specifically for SYNTAX/STRUCTURING..Hope this helps a bit.. JF> Read stats from x-number of QWK files and display the data in a clear JF> and concise manner. Since I have a lot of experience with QWK files, I JF> figured it was a good starting point for learning basic. :) I've been trying to figure out some sort of MSG structure for a Graphical TERM/BBS programs I'm trying to write..I've been doing alot of work, but with limited time comes limited results...I have bit of code here that was posted in this echo a while back, that might help you out... REM REM *** MAILPRNT V2.00 (C)1991 Sean Hawthorne *** REM Syntax: Mailprnt *.msg (Wild cards not allowed) REM ON ERROR GOTO errmsg: openmail: TYPE headertype fromname AS STRING * 20 toname AS STRING * 36 subject AS STRING * 72 datetime AS STRING * 10 timesread AS INTEGER destnode AS INTEGER orignode AS INTEGER cost AS INTEGER orignet AS INTEGER destnet AS INTEGER fill AS STRING * 8 replyto AS INTEGER attribute AS INTEGER nextreply AS INTEGER END TYPE DIM header AS headertype DIM messagebyte AS STRING * 1 filename$ = COMMAND$ OPEN filename$ FOR BINARY AS #1 lenght% = LOF(1) - 190 IF lenght% <= 0 THEN GOTO killfile: Getmail: GET #1, 1, header Editsubject: xc = INSTR(header.subject, "Re:") IF xc = 0 THEN subject$ = header.subject GOTO printheader: END IF subject$ = MID$(header.subject, xc + 3, LEN(header.subject) - (xc + 3)) printheader: PRINT "" PRINT STRING$(78, "=") PRINT " Fm:"; header.fromname; TAB(40); : PRINT "Date/Time: " + header.datetime PRINT " To:"; header.toname PRINT " Re:"; subject$ PRINT STRING$(78, "=") printmessage: messageline$ = "" FOR xd = 1 TO lenght% GET #1, , messagebyte IF messagebyte = CHR$(1) THEN GOSUB stripline: IF messagebyte > CHR$(127) THEN messagebyte = "" IF messagebyte < CHR$(32) AND messagebyte > CHR$(13) THEN messagebyte = "" IF messagebyte < CHR$(13) THEN messagebyte = "" IF messagebyte = CHR$(13) THEN GOSUB printline: messageline$ = messageline$ + messagebyte IF LEN(messageline$) >= 80 THEN GOSUB wordwrap: NEXT xd Closemail: CLOSE #1 PRINT "" PRINT STRING$(19, "="); " MAILPRNT V2.00 (C)1991 Sean Hawthorne "; PRINT STRING$(19, "=") END wordwrap: x = 80 i = 0 WHILE i = 0 a$ = MID$(messageline$, x, 1) IF a$ = CHR$(32) THEN i = x x = x - 1 WEND temp$ = messageline$ messageline$ = MID$(temp$, 1, x) GOSUB printline: messageline$ = MID$(temp$, x + 2, LEN(temp$)) RETURN printline: PRINT messageline$ xe = INSTR(messageline$, "* Origin:") IF xe <> 0 THEN GOTO Closemail: messageline$ = "" messagebyte = "" RETURN stripline: WHILE messagebyte <> CHR$(13) GET #1, , messagebyte WEND messagebyte = "" RETURN killfile: CLOSE #1 KILL filename$ PRINT PRINT " Mailprnt V2.00 (C)1991 Sean Hawthorne " END errmsg: PRINT "" PRINT "Syntax: MAILPRNT *.msg (Sorry no wildcards)" PRINT "" PRINT "MAILPRNT V2.00 (C)1991 Sean Hawthorne" PRINT "" END Hope this helps you out, it has for me..... Special thanks to Sean Hawthorne, and I hope he doesn't mind me RE-posting this....... Sunny Hughes --- Renegade v7-09 Beta * Origin: Later Days, Better Overlays! TELESiS 409-721-9414 (1:3811/118)
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