PDA

View Full Version : PRB: Problem with GetLine in ISX



dbriggs
06-11-2004, 12:20 PM
I have run into a problem with a piece of Script that dates back quite a long way (IS3, probably, in 1999).

I am using GetLine to read a line of data from a text file that has been opened using OpenFile in mode FILE_MODE_NORMAL. The file is located in SUPPORTDIR.

Previously, GetLine has returned the data and has cleared out the output variable so I didn't get a mixture of old and new data.

ISX does not appear to do this, so I get the new data (if there was any) overlaid on the old string contents (if there were any).

Is this a deliberate change (or a bug)?

Thanks for any comments.

David

P.S. I notice that work orders 1-G0UIH, 1-HTRH3, and 1-JR7EJ affecting GetLine are mentioned in the ISX Release Notes (http://support.installshield.com/kb/view.asp?articleid=Q110969)
but this particular problem is not mentioned.

P.P.S. The DS9 and ISX Language References mention using READONLY file mode for reading text files, *but* the GetLine examples use NORMAL mode!

dbriggs
11-02-2004, 01:44 PM
The reason for this problem appears to be that the STRING variables are not automatically sized (e.g. STRING szTemp [255];). It looks as though most if not all built-in functions that return string values into fixed-size variables do not plant a trailing NULL to mark the end of the string.

The workaround, where possible, is to use automatic string sizing. However, I think this is a bug (it's not fixed in SP-2).

The help on declaring variables does not mention any limitations on the use of fixed size strings, only that they are required when passing strings to and from DLL functions.

David