Subj : Re: Mystic structures To : Manuel Adorni From : Nick Andre Date : Wed Mar 23 2022 05:31 pm 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 --- Renegade vY2Ka2 * Origin: Joey, do you like movies about gladiators? (1:229/426) .