0

My code should open 100 files (and do something with them) with next indexes in path like: "c:\Naprzeme\NAPRZ100.IN" next one is "c:\Naprzeme\NAPRZ101.IN" and etc. :

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
}

and fstream infile(supremeCounter) returns error

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)...
nabulke
  • 11,025
  • 13
  • 65
  • 114
Namiastka
  • 74
  • 9

1 Answers1

2

fstream infile(supremeCounter.c_str());

Michael Wild
  • 24,977
  • 3
  • 43
  • 43