TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: TIM HUTZLER
from: MICHAEL RENZMANN
date: 1996-06-20 07:37:00
subject: Passing a field

Hi Tim!
 TH> Don't be silly. I didn't say PB listed that error. I *do* get an
 TH> error - 481. Here is a short prog I'd like you to try.
I first got error 426 at "y = "vxvxvxv." and after the correction I got error 
481 at "POUT [...]".
 TH> If I replace the POUT with below it works fine.
 TH>     z$ = t.str
 TH>     POUT x%, y$, z$
 TH>     t.str = z$
 TH> Frankly, I'm not into Rube Goldburgs.
Try this one:
=== Cut ===
TYPE xs
    str AS STRING * 15
END TYPE
DIM t AS xs
t.str = "This is a test."
SUB pout (x%, x$, y AS xs)
    PRINT x%, x$, y
    y.str = "vxvxvxv."                  '* 1
END SUB
DO
 INCR x%
    y$ = MID$(t.str, x%, 1)
    POUT x%, y$, t                      '* 2
LOOP UNTIL y$ = "."
=== Cut ===
I changed two lines, marked with " '* x" in the source above.
* 1 : you tried to pass a value to the whole type, that doesn't work since 
ou
      can pass a single value only to a special member of that type. Or you
      pass a complete type to the type:
        TYPE xs
            str AS STRING * 15
        END TYPE
        DIM x AS xs, y AS xs
        PRINT "y.str before: !" + y.str + "!"
        x.str = "thisisatest"
        y = x
        PRINT "y.str after : !" + y.str + "!"
        END
* 2 : You told the sub that it has to expect a variable of type xs, but you
      passed it only one member of that type, so it doesn't work. Instead of
      declaring your SUB as in the source above you could also try that one:
        SUB pout (x%, x$, y AS STRING * 15)
      With that declaration your old source should work.
Ok, any questions? No? Thats fine... :))
bye, Mike.
--- 
---------------
* Origin: The Basic Instincts BBS, +49-6032-72557, 24h, v.34 (2:2461/364)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.