Author Topic: Array functions  (Read 2596 times)

0 Members and 1 Guest are viewing this topic.

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Array functions
« 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




« Last Edit: March 08, 2021, 11:22:13 am by NOVARSEG »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Array functions
« Reply #1 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
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline NOVARSEG

  • Forum Resident
  • Posts: 509
    • View Profile
Re: Array functions
« Reply #2 on: March 08, 2021, 11:22:57 am »
ya the mem stuff does work too

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Array functions
« Reply #3 on: March 08, 2021, 11:28:28 am »
What is this for?
Shuwatch!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Array functions
« Reply #4 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.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Array functions
« Reply #5 on: March 08, 2021, 11:51:03 am »
Oh ok. Sounds like it could be useful
Shuwatch!