K
Karim
Hi,
I need to write some code to figure out if a file exists before I
overwrite it.
I came up with this code, but not sure its the best..
bool isImgCached;
TFilePtr pCachedFile = fopen(cachedImgLoc.c_str(),"r");
if (pCachedFile)
{
printDebugInfo("Img is Cached .. using cached version"<<endl);
isImgCached = true;
fclose(pCachedFile);
}
else
{
isImgCached = false;
}
also to remove a file I am using std::remove(cachedImgLoc.c_str());
Any comments?
Thanks.
I need to write some code to figure out if a file exists before I
overwrite it.
I came up with this code, but not sure its the best..
bool isImgCached;
TFilePtr pCachedFile = fopen(cachedImgLoc.c_str(),"r");
if (pCachedFile)
{
printDebugInfo("Img is Cached .. using cached version"<<endl);
isImgCached = true;
fclose(pCachedFile);
}
else
{
isImgCached = false;
}
also to remove a file I am using std::remove(cachedImgLoc.c_str());
Any comments?
Thanks.