Mar 22, 2002
289 Vues
0 0

Parsing Interesting Things

Ecrit par

Someone recently popped into one of the newsgroups I frequent and asked how to parse an INI file. You might have seen those before, with sections and keyword=value lines, like:



[login]

timeout=30

remote=yes

[password]

minlength=6



I think they started in the Microsoft world, since no sane UNIX hacker would have come up with something like that. No, we come up with things like .Xdefaults and sendmail.cf and termcap. But the request seemed simple: parse the file and gather the information into a hash for quick access, two levels deep, of course.

Url : Article complet

Site : samag.com

Catégorie:
News

Laissez un commentaire

Menu Title