Board Program

 BBS: Inland Empire Archive
Date: 02-17-93 (02:02)             Number: 338
From: ROB MCKEE                    Refer#: NONE
  To: DANNY ROBINSON                Recvd: NO  
Subj: Board Program                  Conf: (2) Quik_Bas
Hello Danny!
   You wrote in a message to All:

 DR> I am attempting to write a BBS program in QuickBasic v4.5.
 DR> I have a rough version of the program completed and being
 DR> tested by  several people in my area.  It uses QBFOSSIL45 to

 DR> [4] I am needing code for a word-wrap routine for the
 DR> message base.     If anyone would have something like this,
 DR> I'd appreciate the source for it.

 Part one of JNKK....
 ________O_/________________________| SNIP |______________________\_O_______
         O \                        | HERE |                      / O

 DEFINT A-Z
 SUB Wrap (a$, TheMessage() AS STRING * 80, RightMargin,
TheLine)  ' QBS DIST: No
 ' Why no QBS DIST?  The Complete Code is forth Coming in a
week or so..  ' a$ = the Message unwrapped
 ' RightMargin = Guesswhat?? <G>
 ' TheLine is a Pointer to high Message Line.
 ' This code will handle up to 16K of Message
 WhiteSpace$ = CHR$(10) + "ÿ ./" + CHR$(9)
 Origin = 0
 ' Insert Unknown Origin just in case (Maybe Internet?)
 IF LEN(a$) < 16300 THEN
    a$ = a$ + CHR$(13) + "---" + CHR$(13) + " * Orgin: (Unknown)"  END IF
 ' Weed out the Kludge Lines
 i = INSTR(a$, CHR$(1))
 DO WHILE i
  a$ = LEFT$(a$, i - 1) + MID$(a$, INSTR(i + 1, a$ +
CHR$(13),_   CHR$(13)) + 1)
   i = INSTR(a$, CHR$(1))
 LOOP
 ' Weed Out Line Feeds..  In Fido they're not used (IE:
Soft Returns)  i = INSTR(a$, CHR$(10))
 DO WHILE i
   a$ = LEFT$(a$, i - 1) + MID$(a$, i + 1)
   i = INSTR(a$, CHR$(10))
 LOOP

 DO UNTIL a$ = ""
     CRinA = INSTR(a$ + CHR$(13), CHR$(13))
     b$ = MID$(a$ + CHR$(13), 1, CRinA - 1)
     a$ = MID$(a$, CRinA + 1)
     DO UNTIL b$ = ""
         i = INSTR(b$ + CHR$(13), CHR$(13)) - 1
         IF i < 80 THEN
             TheLine = TheLine + 1
             TheMessage(TheLine) = MID$(b$, 1, i)
             b$ = MID$(b$, 2 + i)
         ELSE
             IF LEN(b$) > RightMargin THEN
                 FOR t = RightMargin TO (RightMargin / 2)
STEP -1                      Ptr = Ptr + 1
                     IF INSTR(WhiteSpace$, MID$(b$, t, 1))
THEN EXIT FOR                  NEXT
                 IF t > (RightMargin / 2) THEN
                     TheLine = TheLine + 1
                     TheMessage(TheLine) = LEFT$(b$, t)
                     b$ = MID$(b$, t + 1)
                 ELSEIF t <= (RightMargin / 2) THEN
                     TheLine = TheLine + 1
                     TheMessage(TheLine) = LEFT$(b$,
RightMargin)                      b$ = MID$(b$, RightMargin
+ 1)
                 END IF
             ELSE
                 TheLine = TheLine + 1
                 TheMessage(TheLine) = b$
                 b$ = ""
             END IF
         END IF
         IF TheLine = 256 THEN EXIT DO
  ' Bail Out if Message is longer than 256 Lines
     LOOP
     IF TheLine = 256 THEN EXIT DO
 LOOP
 IF TheLine < 21 THEN FOR t = TheLine + 1 TO 21: TheMessage(TheLine) =_
  SPACE$(80): NEXT t
 Top = 1:
 ' Lose Everything after Origin Line and Tear
 FOR t = 1 TO TheLine
     IF LEFT$(TheMessage(t) + " ", 4) = "--- " THEN Tear =
True      IF Tear AND ((LEFT$(TheMessage(t), 11) = " *
Origin: ") = True) THEN          FOR g = t + 1 TO 35
             TheMessage(g) = ""
         NEXT
         TheLine = t:
         t = t + 1:
         EXIT FOR
     END IF
 NEXT
 END SUB

________O_/________________________| SNIP
|______________________\_O_______         O \
         | HERE |                      / O   Line wrapping
and message splitted accomplished by MsgSplit 2.00, a
Victor Yiu, Scott Wunsch and Rob McKee creation.


 DR> P.S.  Also, if anybody has any information for programming for Fidonet
 DR> compatibility, that would be appreciated too.  But if
 DR> I can get the Hudson
 DR> message base taken care of, this won't be needed, as
 DR> the mailer utilities will
 DR> take care of the dirty work.

 DR> --- SuperBBS 1.17 Gamma-1 (Reg)
 DR>  * Origin: The Emergency Room BBS  So.Shore, Ky.
 DR> 606-932-4891 (1:2260/150)


 Another ramble from Rob

$$
--- timEd/B6
 * Origin: Scotty, Beam me up, there's no Fortran Programmers Here (1:125/411)
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