Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.bbs.mystic    |    Mystic Sysops are mystical nerds...    |    11,842 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 10,694 of 11,842    |
|    Nick Andre to Manuel Adorni    |
|    Re: Mystic structures    |
|    23 Mar 22 17:31:55    |
      From: nospam.Nick.Andre@f426.n229.z1.fidonet.org              On 23 Mar 22 12:35:53, Manuel Adorni said the following to All:              MA> Anyone have an Mystic BBS structures for QBasic?              Likely not, but its easy to do Pascal to Basic. Use my two function calls:              DECLARE FUNCTION Bas$ (text$)       DECLARE FUNCTION Pas$ (text$)       FUNCTION Bas$ (text$)        IF LEN(text$) > 0 THEN        Bas$ = MID$(text$, 2, ASC(MID$(text$, 1, 1)))        END IF       END FUNCTION       FUNCTION Pas$ (text$)        IF text$ <> "" THEN        Pas$ = CHR$(LEN(text$)) + text$        ELSE        Pas$ = ""        END IF       END FUNCTION              You use these Qbasic functions when you work to-and-from Pascal strings       because the first byte is the length of the string.              So if you had this Pascal structure:              type my_structure = record        something as string[255];       end type;       var my_data = my_structure;              In Qbasic it would be:              TYPE MYSTRUCTURE        SOMETHING AS STRING * 256       END TYPE       DIM MYDATA AS MYSTRUCTURE              Then in Qbasic you would use this to retrive the value:              BasicText$ = Bas$(MYDATA.SOMETHING)              For storing a Basic string to Pascal, it would be:              MYDATA.SOMETHING = Pas$(BasicText$)              Booleans and Char Pascal-types are one byte, so STRING * 1 in Basic. A boolean       True equals CHR$(1).              When working with records, you must define the length of the structure in the       Qbasic OPEN call:              THEPOSITION = 1       OPEN "MYSTIC\COWBELL.DAT" FOR RANDOM AS #1 LEN = LEN(MYDATA)        GET #1, THEPOSITION, MYDATA       CLOSE #1              Hope this helps,              Nick              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca