Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ check if file exits

#include <fstream>
#include<iostream>
using namespace std;
int main() {
   /* try to open file to read */
   ifstream ifile;
   ifile.open("b.txt");
   if(ifile) {
      cout<<"file exists";
   } else {
      cout<<"file doesn't exist";
   }
}
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #check #file #exits
ADD COMMENT
Topic
Name
9+5 =