How to read from file in c++ in ccs in linux ? -
i have got problem, want write code reads file, tried ifstream type doesn't work on linux. had similar problem ? write code in code composer studio,on code blocks works. have error "method 'fail' not resolved.) down below code:
#include <iostream> #include <fstream> using namespace std; int main () { ifstream infile ("input.txt"); if (infile.fail()) { cout << "could not open file\n"; } else { cout << "file opened succesfully\n"; } }
Comments
Post a Comment