Author Topic: Append to appvar  (Read 2570 times)

0 Members and 1 Guest are viewing this topic.

Offline Camdenmil

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 121
  • Rating: +4/-0
    • View Profile
Append to appvar
« on: November 13, 2010, 12:49:37 am »
How do you append data to an appvar? If I have appvar A which is 500 bytes, how do I add 100 bytes to the end of it?
It is bad luck to be superstitious.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Append to appvar
« Reply #1 on: November 13, 2010, 11:00:36 am »
AFAIK you can't do this with anything simple :(

The best way to do it would be something like...

Code: [Select]
"appvTemp"⇒Str1
"appvName"⇒Str2
GetCalc(Str1, new size)⇒A
GetCalc(Str2)⇒B
Copy(B,A,old size)
<data>⇒GDB1
Copy(GDB1,A+oldsize, Δsize)
DelVar Str2
GetCalc(Str2, new size)⇒B
Copy(A,B, new size)
DelVar Str1

where appvTemp is a temporary appvar, appvName is whatever appvar you're using and <data> is whatever data you want to add

if there's any easier way to do this, I'd be interested as well ;)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Append to appvar
« Reply #2 on: November 13, 2010, 11:01:57 am »
AFAIK you can't do this with anything simple :(

The best way to do it would be something like...

Code: [Select]
"appvTemp"⇒Str1
"appvName"⇒Str2
GetCalc(Str1, new size)⇒A
GetCalc(Str2)⇒B
Copy(B,A,old size)
<data>⇒GDB1
Copy(GDB1,A+oldsize, Δsize)
DelVar Str2
GetCalc(Str2, new size)⇒B
Copy(A,B, new size)
DelVar Str1

where appvTemp is a temporary appvar, appvName is whatever appvar you're using and <data> is whatever data you want to add

if there's any easier way to do this, I'd be interested as well ;)

That's about it, unless Quigibo adds the InsertMem/DeleteMem functions (feature request bump ;D).
« Last Edit: November 13, 2010, 11:02:10 am by Deep Thought »




Offline Camdenmil

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 121
  • Rating: +4/-0
    • View Profile
Re: Append to appvar
« Reply #3 on: November 13, 2010, 04:22:14 pm »
That's how I was doing it. At least I wasn't missing an obvious command  :)
It is bad luck to be superstitious.