Añado pruebas
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
std::map<std::string, std::string> LeerArchivo(const std::string& filename) {
|
||||
std::map<std::string, std::string> datos;
|
||||
std::ifstream file(filename);
|
||||
std::string linea;
|
||||
|
||||
while (std::getline(file, linea)) {
|
||||
size_t pos = linea.find(":");
|
||||
if (pos != std::string::npos) {
|
||||
std::string clave = linea.substr(0, pos);
|
||||
std::string valor = linea.substr(pos + 2);
|
||||
datos[clave] = valor;
|
||||
}
|
||||
}
|
||||
return datos;
|
||||
}
|
||||
Reference in New Issue
Block a user