Q40361: QuickBASIC Cursor Position Incorrect after Interlanguage Write
Article: Q40361
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | SR# S890104-135 B_BasicCom | mspl13_basic
Last Modified: 15-DEC-1989
If a Microsoft QuickBASIC program calls a subroutine or function
written in another language (Microsoft C, Pascal, Assembly, or
FORTRAN) that writes information to the screen, the QuickBASIC cursor
position is not updated.
This information applies to Microsoft QuickBASIC Versions 4.00, 4.00b,
and 4.50, Microsoft BASIC Compiler Versions 6.00 and 6.00b for MS-DOS
and MS OS/2, and Microsoft BASIC PDS Version 7.00 for MS-DOS and OS/2.
The sample program below calls a FORTRAN subroutine. The FORTRAN
subroutine starts writing to the screen at the point where QuickBASIC
finishes.
This program example's printout is readable. The FORTRAN information
is printed on line 10 and the BASIC information is printed on lines 1
and 2. However, if you remove the second LOCATE statement, both
FORTRAN and BASIC print on line 10.
The following is a code example:
DECLARE SUB forsub (BYVAL addr%, BYVAL addr2%, x&, y&)
DIM b%(3000) 'Needed if any string is changed
COMMON /nmalloc/ b%()
B$ = "there " 'FORTRAN expects these to be 10 long
a$ = "hello " 'Allocate space for the string 10.
x&= 1
y&= 2
CLS
LOCATE 10, 1
CALL forsub(SADD(a$),SADD(b$), x&, y&)
LOCATE 1, 1
PRINT a$;" "; b$, x&, y&
The following is the FORTRAN subroutine:
SUBROUTINE FORSUB(A, B, C, D)
CHARACTER*10 A [NEAR]
CHARACTER*10 B [NEAR]
INTEGER*4 C [NEAR]
INTEGER*4 D [NEAR]
WRITE(*,*) A, B, C, D
A = 'hi there '
B = 'lets talk'
C = 3
D = 4
END
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.