Big cleanup... Expect bugs
This commit is contained in:
31
StringFunctions.h
Normal file
31
StringFunctions.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "ErrorFunctions.h"
|
||||
|
||||
std::string Convert (float number){
|
||||
std::ostringstream buff;
|
||||
buff<<number;
|
||||
return buff.str();
|
||||
}
|
||||
|
||||
std::string ExePath() {
|
||||
char buffer[MAX_PATH];
|
||||
GetModuleFileName( NULL, buffer, MAX_PATH );
|
||||
std::string::size_type pos = std::string( buffer ).find_last_of( "\\/" );
|
||||
return std::string( buffer ).substr( 0, pos);
|
||||
}
|
||||
|
||||
std::string GetFileInPath(std::string file)
|
||||
{
|
||||
std::string name = ExePath() + file;
|
||||
struct stat buf;
|
||||
if (stat(name.c_str(), &buf) != -1)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
else
|
||||
OnError(202, " \r\nFile not found: " + name);
|
||||
return NULL;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user