Qbasicnews.com
I know its possible, but i don't know how - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html)
+--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html)
+--- Thread: I know its possible, but i don't know how (/thread-8388.html)



I know its possible, but i don't know how - wallace - 11-13-2005

I have a large chunk of code that is identical to another chuck of code except for one buffer change.

In one block I PUT an array to buffer() and in the other it goes to buffer2(). There is a variable that determines which to go to: This is what it looks like now:
Code:
IF a = 1 then
   put buffer, (0, 0), array, pset
ELSE
   put buffer2, (0, 0), array, PSET
END IF

this is a dumbed down version, there are a lot of PUT statements. What I want to do is simply change a pointer.

Something like this, but not this:

Code:
dim where as pointer
if a = 1 then
   where= @buffer(0)
else where = @buffer2
end if
put where, (0, 0), array, PSET



I know its possible, but i don't know how - red_Marvin - 11-13-2005

Code:
dim where as integer ptr
?


I know its possible, but i don't know how - Jofers - 11-13-2005

I don't understand... that doesn't work, or it's too long? If it's too long, use IIF:

Code:
where = iif(a=1, @buffer(0), @buffer2(0))