C++相談室 part92
■ このスレッドは過去ログ倉庫に格納されています
0735デフォルトの名無しさん
2011/12/12(月) 23:26:03.65#include <fstream>
#include <sstream>
#include <string>
template<typename T>
void get_value(std::ifstream &file, T &value){
std::string line;
if(std::getline(file, line)) std::istringstream(line) >> value;
}
int main(){
int A;
int B;
double C;
if(std::ifstream file = std::ifstream("setting.ini")){
get_value(file, A);
get_value(file, B);
get_value(file, C);
}
}
■ このスレッドは過去ログ倉庫に格納されています