Sections in INI Files zählen
-
Mich würde interessieren, wie ich die Anzahl der Sections in einer INI Datei auszählen und deren Namen ausgeben kann. Würde mich freuen, wenn ihr mir helfen könntet.
mfg

-
void do_what_i_want (const std::ifstream& infile) { int i = 0; std::string s; while (!infile.eof ()) { getline (infile, s); if (*s.begin () == '[' && *(--s.end ()) == ']') { ++i; std::cout << s.substr (1, s.length () - 1) << std::endl; } } }Sollte funktionieren können (vorausgesetzt ich habe an das gleiche ini-Format gedacht wie du)