Checking if an Image Exists [cpp && d3d]
I need to check if a bitmap image specified by a filename exists or not before I try to use it. What function/technique can I use to find out? I'm using C++ and Direct3D.
Assumming you dont want to use some 3rd party library like boost, how about:
Alan
#include <fstream>bool file_exists(const std::string & filename){ std::ifstream file(filename.c_str()); return file.is_open();}
Alan
Its a generic Input File STREAM. It has absolutly no knowledge of whats in the file. Be aware that this will only tell you if the file exists or not, not if its a valid bitmap.
Alan
Alan
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement