27 bool fileExists =
false;
28 std::ifstream in(filePath.c_str(), std::ios::in);
42 fopen_s(&fp, filePath.c_str(),
"rb");
44 fp = fopen(filePath.c_str(),
"rb");
51 fseek(fp , 0 , SEEK_END);
60 return std::remove(filePath.c_str());
64 const std::string &newFilePath)
66 return std::rename(oldFilePath.c_str(), newFilePath.c_str());
71 std::string fullPath = filePath;
73 for(
int i=(
int)fullPath.size()-1; i>=0; --i)
75 if(fullPath[i] ==
'/' || fullPath[i] ==
'\\')
81 name.insert(name.begin(), fullPath[i]);
89 std::list<std::string> list =
uSplit(filePath,
'.');
97 void UFile::copy(
const std::string & from,
const std::string & to)
99 std::ifstream src(from.c_str());
100 std::ofstream
dst(to.c_str());
static int erase(const std::string &filePath)
std::string getExtension()
Wrappers of STL for convenient functions.
std::list< std::string > uSplit(const std::string &str, char separator=' ')
static void copy(const std::string &from, const std::string &to)
static int rename(const std::string &oldFilePath, const std::string &newFilePath)