04-21-2005, 05:51 PM
[syntax="quickbasic"]
dim S as string * 10
sub Foo (byref Text as string * 10)
print Text
end sub
Foo S
[/syntax]
This gives me an illegal specification at parameter 1 in Foo.
I really need to pass a constant length string by reference, because I'm building a generic menu system which shows the contents of a variable by calling a sub to format it right (ie. ShowInteger would format and print an integer, ShowTime would format and show a time value). So I use function pointers where one of the arguments is "byref Var as any" and then in for example ShowInteger I do "byref Var as integer", but if I do "byref Var as string * 30", it complains and gives me the same error.
Anyways, is it possible to pass string * n to a sub at all?
dim S as string * 10
sub Foo (byref Text as string * 10)
print Text
end sub
Foo S
[/syntax]
This gives me an illegal specification at parameter 1 in Foo.
I really need to pass a constant length string by reference, because I'm building a generic menu system which shows the contents of a variable by calling a sub to format it right (ie. ShowInteger would format and print an integer, ShowTime would format and show a time value). So I use function pointers where one of the arguments is "byref Var as any" and then in for example ShowInteger I do "byref Var as integer", but if I do "byref Var as string * 30", it complains and gives me the same error.
Anyways, is it possible to pass string * n to a sub at all?