Files
Blocks3D/StringFunctions.cpp
2019-11-04 23:57:31 -05:00

35 lines
704 B
C++

#include <G3DAll.h>
#include <sstream>
#include "ErrorFunctions.h"
#include "StringFunctions.h"
#include <windows.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;
}