PDA

View Full Version : Problems with FileInsertLine



puzzled1234
05-18-2004, 03:30 PM
In my install a parse a text file by using grep to find a matching line and FileInsertLine to replace the line if its the one I'm looking for. For some reason FileInsertLine at one point in the code Inserts the line where I want it, but it then deletes all the subsequent lines in the text file. Is this a bug in the InstallShield code. The function works fine elsewhere in the project. I'm using the following parameters:

FileInsertLine( szFile, szNewLine, nzLineNumber, REPLACE );

I had read in another thread that perhaps FileInsertLine has some problems, but I'm not sure. Any thoughts would be great.

Thanks

neeshd
05-26-2004, 12:18 PM
Below is what I used and had no problems...


oldString= "the original string you want to change"
newString = "what you want to change original string to"

begin

FileGrep(targetDir^targetFile, oldString, svReturnLine, svReturnLine, nvLineNumber, RESTART);

FileInsertLine(targetDir^targetFile, newString, nvLineNumber, REPLACE);

end;


Neeshant Desai
Software Engineer
Hewlett-Packard