Re: Replace word in text file
From: Ed Morton (mortonAVOIDINGSPAM_at_lucent.com)
Date: 11/05/03
- Next message: Keith Thompson: "Re: "Mastering C Pointers"...."
- Previous message: William Payne: "Re: Replace word in text file"
- In reply to: William Payne: "Re: Replace word in text file"
- Next in thread: Alex: "Re: Replace word in text file"
- Reply: Alex: "Re: Replace word in text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 05 Nov 2003 15:24:20 -0600
On 11/5/2003 3:14 PM, William Payne wrote:
> "Richard Heathfield" <dontmail@address.co.uk.invalid> wrote in message
> news:bobood$62v$2@titan.btinternet.com...
<snip>
>>I suggest you replace this line with:
>>
>> if(strcmp(line, "set imap_user=root\n") == 0)
<snip>
> Thanks for the quick reply, Mr Heathfield. It appears that you are right
> about fgets() not stripping the newline because I got an empty line between
> the printf()-statements in the while()-loop. So I wrote strcmp() as you
> suggested, but it still fails to match the string. =( Any ideas?
Not all OSs just use "\n" as the line terminator. Try adding "\n\r" instead of
just "\n". This approach still fails if "fgets()" doesn't read to the end of
the line...
Ed.
> / William Payne
>
>
- Next message: Keith Thompson: "Re: "Mastering C Pointers"...."
- Previous message: William Payne: "Re: Replace word in text file"
- In reply to: William Payne: "Re: Replace word in text file"
- Next in thread: Alex: "Re: Replace word in text file"
- Reply: Alex: "Re: Replace word in text file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|