My installation at the moment edits a text file with a path e.g. TARGETDIR+"\\etc" and populates to c:\nexor\etc.
However, due to how our product works we need to either convert the \ to / or have them as \\ in the text file. Therefore, I'm trying to search for the string \\ which is an escape character for \, in the text file which contains paths with \ and do a WriteLine or FileInsertLine to replace it. However, the filegrep command doesn't appear to find the instances of it and svReturnLine = "" and nvLineNumber=0. The output is that it puts a / at the end of the file. Can any please help as this is quite a severe problem and is starting to become quite annoying.
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Help! FileGrep not finding a string
Started by
clareb22
, Apr 09 2002 09:20
2 replies to this topic
Posted 09 April 2002 - 10:17
I've managed to get it to find the string, however it doesn't seem to find all instances of the string. My next main issue is that it can only append to the end of the line as the functions rely on the line number count. There must be a way of appending to a string based on character counts. So that in a line e.g. c:\program files\nexor\etc I can append as c:\\program files\\nexor\\etc rather than what it does at the moment c:\program files\nexor\etc\\. Here is an example of the code that I have so far
while (nvLineNumber <= 0)
if (FindFile (szPath, "ncs.cfg", svResult) = 0) then
if (FileGrep (szNCSPath, szSlashSearch, svReturnLine, nvLineNumber, CONTINUE)=0) then
OpenFileMode(FILE_MODE_APPEND);
OpenFile (nvFileHandle, szPath, "ncs.cfg");
FileInsertLine (szNCSPath, "\\\\", nvLineNumber, APPEND);
CloseFile (nvFileHandle);
endif;
endif;
endwhile;
while (nvLineNumber <= 0)
if (FindFile (szPath, "ncs.cfg", svResult) = 0) then
if (FileGrep (szNCSPath, szSlashSearch, svReturnLine, nvLineNumber, CONTINUE)=0) then
OpenFileMode(FILE_MODE_APPEND);
OpenFile (nvFileHandle, szPath, "ncs.cfg");
FileInsertLine (szNCSPath, "\\\\", nvLineNumber, APPEND);
CloseFile (nvFileHandle);
endif;
endif;
endwhile;
Many thanks[br]Clare