Have you considered reading the lot of it into a map<string, string>? That would certainly simplify lookups.