Passing Array of TYPE or Fixed-Length Strings to SUBprogram (31557)
The information in this article applies to:
- Microsoft QuickBASIC 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft QuickBASIC 4.5
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
- Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
- Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.1
This article was previously published under Q31557 SUMMARY
An array of fixed-length strings cannot be passed directly as a
parameter to a SUBprogram or FUNCTION procedure (that is, the phrase
AS STRING*n cannot be used in DECLARE, SUB, or FUNCTION statements).
The following are three alternatives for passing an array of
fixed-length strings to a procedure:
- Pass the array of fixed-length strings through COMMON SHARED.
(Please see Example 1 below.)
- Convert the array of fixed-length strings to an array of
user-defined type and pass the array AS that type. (Please see
Example 2 below or the TORUS.BAS sample program provided on the
release disk.)
- Convert the array of fixed-length strings to an array of
user-defined type and pass that array through COMMON SHARED. (Please
see Example 3 below.)
This information applies to QuickBasic Versions 4.00, 4.00b and 4.50,
to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and
OS/2, and to Microsoft Basic Professional Development System (PDS)
Versions 7.00 and 7.10 for MS-DOS and MS OS/2.
Modification Type: | Minor | Last Reviewed: | 1/9/2003 |
---|
Keywords: | KB31557 |
---|
|