Thread: ifstream

  1. #1
    Registered User cppdude's Avatar
    Join Date
    Jan 2002
    Posts
    62

    ifstream

    how can i use ifstream to check whether the file exists?

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Try to open it.

  3. #3
    Registered User cppdude's Avatar
    Join Date
    Jan 2002
    Posts
    62
    yes but i need the code to check if its open!

  4. #4
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Code:
    	ifstream is("file.txt");
    
    	if(!is)
    		cerr << "Error Opening File\n";

  5. #5
    Registered User cppdude's Avatar
    Join Date
    Jan 2002
    Posts
    62
    cheers mate

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple ifstream Question
    By Paul22000 in forum C++ Programming
    Replies: 8
    Last Post: 12-05-2008, 05:34 PM
  2. store data from ifstream and store in link list
    By peter_hii in forum C++ Programming
    Replies: 2
    Last Post: 10-26-2006, 08:50 AM
  3. ifstream
    By Wraithan in forum Tech Board
    Replies: 3
    Last Post: 09-24-2006, 01:26 AM
  4. ofstream and ifstream for searching and writing
    By johnnyd in forum C++ Programming
    Replies: 6
    Last Post: 03-17-2003, 08:34 AM
  5. Ifstream Problems
    By IlUomo in forum Windows Programming
    Replies: 1
    Last Post: 04-24-2002, 12:51 PM