[prog] Re: [Courses] String Comparation...
Jenn Vesperman
jenn at anthill.echidna.id.au
Fri Oct 4 02:22:21 EST 2002
On Fri, 2002-10-04 at 00:21, Abel Pires da Silva wrote:
> Situation:
> I have *one* line data stored in hostname,
> I also have *many-many* lines of data stored in
> buffer....
>
> Question:
> How to compare hostname and buffer (line by line), to
> check is there a match between the *one* line in
> hostname with *any line* in buffer....
(Moving this to the programming list, please forward all replies to
programming at linuxchix.org and, if necessary, subscribe there.)
Try something of the order of:
repeat {
line = get_line(buffer);
match = compare(line, data);
} until ((line == EOF) || (match == true);
You can do the same with while(line != EOF && match == false) or
anything else, the important part is that you can do it by looping over
the file line by line.
Jenn V.
--
"Do you ever wonder if there's a whole section of geek culture
you miss out on by being a geek?" - Dancer.
jenn at anthill.echidna.id.au http://anthill.echidna.id.au/~jenn/
More information about the Programming
mailing list