0

i have got a problem, I want to write code which reads from file, i tried ifstream type but it doesn't work on my linux. Does anyone had similar problem ? [EDIT] (I write this code in Code Composer Studio,on Code Blocks it works. i have an error that say "method 'fail' could not be resolved.) Down below my 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"; 
}  
}
ewaw
  • 1
  • 2

0 Answers0