TG> In article "Re: Passing a field" (on 16.06.96), Tim Hutzler@1:119/88
TG> says:
TG> Hello Tim !!
TH> What do I need do to to reference the element *and* make
> modifications to it from within a SUB?
TG> -----------------------------------------------------------------
TG> TYPE
TG> xs var AS INTEGER
TG> str AS STRING * 15
TG> END TYPE
TG> DIM t AS xs
TG> t.var = 1
TG> t.str = "This is a test."
TG> CLS
TG> PRINT t.var, t.str
TG> Pout1 t.var, t.str
TG> PRINT t.var, t.str
TG> SUB pout1 (x AS INTEGER, y AS STRING * 15)
TG> x = x + 1
TG> y = "Pout 1"
TG> END SUB
TG> -!- Cut End
TG> --------------------------------------------------------------
Thank you, I have since found that this works.
TG> ... or make the TYPE-structure as SHARED.
It first - "DIM t AS SHARED xs" did not seem to work.
When I tried it again, it seemed to. Oh, well.....
BTW, occationally I get an error 6 (overflow) on PRINT statements.
For example....
PRINT x??
Produces a run-time error 6. Why? The type is already defined, the number is
already assigned, I can manipulate it, change it... But, when I try to print
it I get this error... I don't get it.
Enevitably, I will change some code around elsewhere in the program,
and the error goes away. But, I don't know what I am doing, it's the
shotgun approach.
Any, idears?
TG> Regards,
TG> email: author@pbsound.snafu.de
TG> www : http://www.snafu.de/~pbsound/ (PowerBASIC's Home in Germany)
TG> PBSOUND - The Sound Blaster Toolkit, PowerBASIC-FAQ,
TG> PowerBASIC- sources & toolboxes, PowerBASIC on Web, PowerBASIC
TG> News and much more or less important PowerBASIC stuff.
I D/L'd PBSOUND, but I haven't had the chance to work with it yet.
I still need to master the PB particulars first.
--- Maximus/2 3.01
---------------
* Origin: Madman BBS * Chico, California * 916-893-8079 * (1:119/88)
|