Qbasicnews.com

Full Version: I know its possible, but i don't know how
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Code:
dim where as integer ptr
?
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))