QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: NOVARSEG on March 08, 2021, 03:23:22 am

Title: Array functions
Post by: NOVARSEG on March 08, 2021, 03:23:22 am
DIM A(3) as integer

DIM B AS STRING * 8

GET #1 ,, B

A() = B

or

B = A()

PUT #1,, B
****
Been lookin at EXEs with hex editor  to see what can do




Title: Re: Array functions
Post by: SMcNeill on March 08, 2021, 05:08:01 am
DIM A(3) AS INTEGER
DIM B AS STRING
DIM TempMem AS _MEM: _TtempMem = _MEM(A)

Array2String TempMem, B
‘Your array is now in your string
‘Do stuff

String2Array B, TempMem
‘Your string is now your array


SUB Array2String (M AS _MEM, S AS STRING)
   S = SPACE$(M.SIZE)
   _MEMGET M, M.OFFSET, S
END SUB

SUB String2Array (S AS STRING, M AS _MEM)
    _MEMPUT M, M.OFFSET, S
END SUB
Title: Re: Array functions
Post by: NOVARSEG on March 08, 2021, 11:22:57 am
ya the mem stuff does work too
Title: Re: Array functions
Post by: SpriggsySpriggs on March 08, 2021, 11:28:28 am
What is this for?
Title: Re: Array functions
Post by: SMcNeill on March 08, 2021, 11:50:40 am
What is this for?

I think it’s to put an array into a string, and vice-versa, so you can GET/PUT with a single pass.
Title: Re: Array functions
Post by: SpriggsySpriggs on March 08, 2021, 11:51:03 am
Oh ok. Sounds like it could be useful