15 lines
478 B
C++
15 lines
478 B
C++
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;
|
|
} |