Toolbox Library Routine String Arguments Have 255-Byte Limit (33304)



The information in this article applies to:

  • Microsoft QuickBASIC 1.0
  • Microsoft BASIC Compiler
  • Microsoft BASIC Interpreter for Apple Macintosh 3.0

This article was previously published under Q33304

SUMMARY

The Toolbox Library routines that utilize string variables are limited to strings of 255 characters or less. The Toolbox Library routines make ROM calls that use Pascal strings limited to 255 characters in length.

For example, the MBLC Toolbox routine GetDialogText will only take the first 255 characters from an edit field, even if there are more than 255 characters of input. It does not give an error message; it just ignores anything past the 255th character.

This information applies to Microsoft QuickBASIC Version 1.00, Microsoft BASIC Compiler Version 1.00, and Microsoft BASIC Interpreter Version 3.00 for the Apple Macintosh.

MORE INFORMATION

The following is an example that runs in the BASIC interpreter Version 3.00 or in the BASIC compiler Version 1.00 for the Macintosh (it will need to be modified for QuickBASIC):
'The following program uses a dialog box located in the resource fork
'of the DialogRes program on the "BASIC Toolbox" disk (in BASIC 3.00).
'The buttons on the left side of the dialog box can be ignored --
'The program will accept input into the edit field until the OK or
'the CANCEL button is pressed.
LIBRARY "BASIC Toolbox:ToolLib"
ref% = 0: D! = 0: item% = 0: t$ = ""
OpenResFile "BASIC Toolbox:DialogRes", ref%
GetNewDialog ref%, 1, D!
WHILE item% <> 7 AND item% <> 1   'While OK or CANCEL aren't pressed.
   ModalDialog D!, item%
   GetDialogText D!, 6, t$
   LOCATE 1, 1
   DrawText STR$(LEN(t$))     'Print length of string from GetDialogText.
WEND
DisposeDialog D!
'Any characters beyond the 255th have been ignored.
Print "The last 20 characters of the edit field are:"
PRINT RIGHT$(t$, 20)
				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB33304