From: Leandro Lucarella Date: Sun, 6 Nov 2005 22:49:54 +0000 (+0000) Subject: Bugfix. X-Git-Tag: darcs_import~33 X-Git-Url: https://git.llucax.com/z.facultad/75.29/susanita.git/commitdiff_plain/dfd0218b2eec273821401b2715f177b7b2de7a22?hp=dc520fd7ae38100afa95ee803755495f277c6473 Bugfix. --- diff --git a/src/parser.cpp b/src/parser.cpp index 4bd29f1..b5fccb4 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -115,3 +115,27 @@ output() const } } +/// Hack medio feo para obtener el N del problema +Susanita::size_type +Parser:: +get_n(const std::string& filename) +{ + std::ifstream f(filename.c_str()); + if (!f) + return 0; + std::string l; + if (!std::getline(f, l)) + return 0; + std::istringstream ss(strip(l)); + // descartamos el nombre + get_hasta(ss, ':'); + // contamos personas en la lista + Susanita::size_type count = 0; + while (ss) + { + if (!strip(get_hasta(ss, ',')).empty()) + ++count; + } + return count; +} +