Page 1 of 1

PEEK

Posted: Tue Dec 07, 2004 3:35 am
by Lily
I don't understand why, assigning a value to a variable,say: X$="C" if you change with POKE the value in the memory containing this value , and write "D" inside for instance,if you then ask for a new print of this variable, you still get the former value (C)and not the new value you poke inside.("D")

Posted: Tue Dec 07, 2004 11:33 am
by Z!re
This is for QB 7.1 (PDS) ONLY!

Code: Select all

x$ = "C"
Def Seg = sseg(x$)
Poke sadd(x$), asc("D")
Def Seg
print x$
In QB45 you should change SSEG to VARSEG, and SADD to VARPTR

Untested, but this should work.

Posted: Tue Dec 07, 2004 3:15 pm
by Guest
Look at Z!res post, but in the furure post code.

PEEK

Posted: Wed Dec 08, 2004 7:38 am
by LILY
Here are the results:
in QB45 the screen shows several inadequat characters at the top,and a new run send the instruction:"chains space altered" and a new "enter" makes the program to close
in GW the system answers"mismatch" at line :
DEF SEG =VARSEG(X$)
in QB 7.1
the letter "D" is printed but the screen (pink) is flashing with the MICROSOFT initial warning at the top.System looks unstable.Is it possible to stop that?

This said, could you be kind enough to tell me what would be the code
1.in case X$ would be a table let say 4X4 with elements being letters
2.in case X would be the same table but with elements as figures

correction

Posted: Wed Dec 08, 2004 9:23 am
by LILY
It works well with QB 7.1 as long as instruction SCREEN 12 is added.
But it is still non working in QB4.5

So now how to do with a table as variable?

PEEK-END?

Posted: Wed Dec 08, 2004 9:46 am
by LILY
What to do now if one element of the table is a figure for instance "1" and I want to poke at its place a group of letters, for instance"ABC"? The program gives only one letter (the first one, A). if I put 2 figures (for instance,12) as variable, the poke gives me 2 letters but the second letter is the same as the above 2 .I get A2 for instance...