April 27, 2024, 11:10:38 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Some peculiarity with Istring

Started by Ficko, January 29, 2007, 09:08:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ficko

I have a little bit hard time with Istring.

There is my code:

OPENCONSOLE
DEF Text[10,512] AS Istring

FOR A=0 TO 9
   Text[A] = STRING$(511,"H")
   PRINT LEN(Text[A])
   Func(Text[A])
NEXT A

DO:UNTIL INKEY$<>""
END

SUB Func(Ftext AS String)
   DEF MyString[512] AS IString
   MyString = Ftext
   Print Len(MyString)
ENDSUB

The â€Ã...“SUB Funcâ€Ã, won’t compile with Istring so I tried to use String instead.
It works but I am worried that I kind of  â€Ã...“over-stretchingâ€Ã, the String so I put it immediately into another Istring variable to work with.

Could it cause a memory overwrite despite that? ???

Csaba

Ionic Wind Support Team

ISTRING is a keyword, not a type.  You are doing it correctly now. The ISTRING keyword just lets you dimension a string to something besides the stock 255 characters.

Strings are passed by reference so the length of a string as a parameter is equal to the length that is passed.  In otherwords you are referencing the string that is passed to the function, not a separate copy.

Paul.
Ionic Wind Support Team

Ficko

Ok, that makes sence!

Thank You Paul