delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/29/21:02:53

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: how to search and replace a string
Date: Sat, 29 Aug 1998 20:34:18 -0300
Organization: NBTel Internet
Lines: 19
Message-ID: <35E88FFA.79C4E781@unb.ca>
References: <19980829 DOT 152037 DOT 2271 DOT 4 DOT tonyblaha AT juno DOT com>
NNTP-Posting-Host: fctnts10c33.nbnet.nb.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

tonyblaha AT juno DOT com wrote:
> Wallpaper=filename.bmp
> And change it to another filename... But since "filename.bmp" could be
> anything, how do I search for this string? Basically, I'd need to search
> for "Wallpaper=" and then change the entire line to something else.
	You will have to copy every part of the file into another file, putting your
filename instead of the old one, then rename the temporary file back to
Win.ini.
	Well, since you know that 'Wallpaper' will be the first word on the line, you
can search for '\n' in the file, then see if the next 10 characters are
"Wallpaper=".  If they are, discard the rest of the line and write the desired
filename into that place.
-- 
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT GeoCities DOT com
          Endlis AT nbnet DOT nb DOT ca


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019