Jump to content


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.
Photo

Checking for end of file with while/endwhile


3 replies to this topic

RayKode

RayKode
  • Full Members
  • 58 posts

Posted 30 June 2005 - 14:19

Good morning all,

I'm really new to this so your patience is appreciated.

I want to read through a file, line by line, and then, if a line contains a certain character, substitute a diffent character and then re-write the line back into the file.

I've pretty much figured out how to do that.

However, I would like to use (I think) the while/endwhile loop control.

I would like to say something like the following, but I can't quite figure out how to write it.

while (the file is not at the "end of file") <= How should this statement be written ?
Do stuff <== This I have figured out
endwhile;

Thanks a whole lot, for any suggestions.

Ray in Wisconsin

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 04 July 2005 - 14:21

Which function are you using to read from the file? It should have a special return code to indicate end of file.
You may also want to look at sample "Search and Replace a String in a File" at http://www.installsi...en/isp_comp.htm

RayKode

RayKode
  • Full Members
  • 58 posts

Posted 06 July 2005 - 13:48

Good morning Stephan,

I am using FileGrep.

AND, your suggestion to "check out the sample search and replace a string in a file" code, did the trick for me.

I now have things working as I had envisioned.

Your replies kind sir, (you have helped me in the past) are truly appreciated.

Thanks again.

Ray in Wisconsin


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 06 July 2005 - 13:56

I'm glad you got it working.
FYI FileGrep return values:
END_OF_FILE (-4) The end of file was reached without finding the search string.