[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppFileExists
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppFileExists
(C++) How can I check if a file exists?
A handy File I/O function.bool fileExists(const std::string& fileName) { std::fstream fin; fin.open(fileName.c_str(),std::ios::in); if( fin.is_open() ) { fin.close(); return true; } fin.close(); return false; }
- include <fstream>
Other code snippets
Check if a file exists (C++ Builder)
Code links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
