Coder's Guild Mailing List

reading name=value pairs from a file

Posted by Morgan Terry on 1999-06-10

I am trying to write a small function to read .ini file like entries
(name=value) from a file.  I've tried doing fgets() then sscanf() with
"%s=%s" as the format string, but it reads the whole string into the
entry variable, and doesn't read anything into the value variable.  Is
there a way to make it stop scanning at the equal sign ('=') instead of
whitespace?  Is there a better way to read these in?  Thanks.