|
Posted by pete on June 19, 2008, 8:25 am
Please log in for more thread options
Bartc wrote:
>>
>>> Dennis wrote:
>>>> Hi, I have a text file that contents a list of email addresses like
>>>> this:
>
>>> /* BEGIN new.c output */
>
>>> <snip 250+ lines of C >
>
>> Wow - All that just to separate @hotmail.com from anything else ? I'm
>> glad I stuck with perl :)
>
> I think pete just enjoys writing huge amounts of C code. Or showing off..
I can see why you might think that.
> I thought my 50-line answer (posted to comp.lang.c only) might have been a
> bit long because it didn't make clever use of scanf(), but at least it could
> deal with /any number/ of email addresses from a file.
>
> This code I /think/ only deals with the 4 email addresses in the OP's
> example..
It deals with how many and whichever string literals
are placed into this macro:
#define STRINGS \
{ "\"foo@yahoo.com\"", "\"tom@hotmail.com\"", \
"\"jerry@gmail.com\"", "\"tommy@apple.com\""}
The program uses the STRINGS macro to initialize the input file.
--
pete
|