Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

check if file exists c++

#include <iostream>
#include <fstream>
using namespace std;

int main()
{
    ifstream file("myfile.txt");
  
    if(!file) // checks the existence of file
        cout<< "file was not found ";
  	return 0;
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #check #file #exists
ADD COMMENT
Topic
Name
3+7 =