Hello Jacques,

I found this one curious so quickly write the MB program below. It seems to
work fine on Pro v4.5, v6.0 and v7.0. Sorry, don't have v6.5 installed. I
presume the variable used for argument 2 to the Mid$() function is a
smallint or integer?

Regards,
Warren Vick
Europa Technologies Ltd.
http://www.europa-tech.com

' MID_TEST.MB - Test the argument ranges of the Mid$() function.

' Definitions

' Includes
include "mapbasic.def"
include "icons.def"
include "menu.def"

' Declarations
declare sub main

' Variables

sub main
   dim BigString as string
   dim i as integer
   dim j as smallint

   CLS

   BigString = string$(32767, "x")              ' Largest string possible

   print "BigString has "+len(BigString)+" characters, all x's."

   ' With a literal
   print "Mid$(BigString, 29700, 10) = "+chr$(34)+Mid$(BigString, 29700,
10)+chr$(34)

   ' With an integer variable
   i = 29700
   print "i (integer) = "+i
   print "Mid$(BigString, i, 10) = "+chr$(34)+Mid$(BigString, i,
10)+chr$(34)

   ' With a smallint variable
   j = 29700
   print "j (smallint) = "+j
   print "Mid$(BigString, j, 10) = "+chr$(34)+Mid$(BigString, j,
10)+chr$(34)
end sub

' End

-----Original Message-----
From: Jacques Paris [mailto:[EMAIL PROTECTED] 
Sent: 20 November 2003 22:49
To: MIL
Subject: MI-L limit in mid$() size


The length of a string variable into which I read the record of a file is of
32766. I use the mid$() function to extract bits and pieces. When the start
parameter (second argument) reaches 29696, there is an error message
"Overflow Mid$; argument 2 has invalid type". As the same formula has worked
previous to the break over 1100 times, I would guess that it is a question
of the size of the argument.

MI 6.5  Any info of the subject?

Jacques Paris
e-mail  [EMAIL PROTECTED]
MapBasic-MapInfo support  http://www.paris-pc-gis.com




---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com | To
unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 9250




---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 9254

Reply via email to