0

私のコードは、「c:\Naprzeme\NAPRZ100.IN」のようなパスの次のインデックスを持つ 100 個のファイルを開く (そしてそれらに対して何かを行う) 必要があります。

for (int as=100;as<159;as++){
    ostringstream ss;
    ss << as;
    string cherk = ss.str();
string supremeCounter = "c:\\Naprzeme\\NAPRZ"+cherk+".IN";
fstream infile(supremeCounter);
//....other code here
}

そしてfstream infile(supremeCounter)エラーを返します

28 31 C:\Users\talent\Documents\File.cpp [Error] no matching
 function for call to     'std::basic_fstream<char>::basic_fstream(std::string&)' 
candidates are: //(here some libs)...
4

1 に答える 1

2

fstream infile(supremeCounter.c_str());

于 2013-02-06T11:46:59.937 に答える