PEEK

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Lily

PEEK

Post 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")
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post 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.
I have left this dump.
Guest

Post by Guest »

Look at Z!res post, but in the furure post code.
LILY

PEEK

Post 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
LILY

correction

Post 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?
LILY

PEEK-END?

Post 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...
Post Reply