Play-/Source/Utils.cpp
jpd002 568d187f87 MacOS
git-svn-id: http://svn.purei.org/purei/trunk@185 b36208d7-6611-0410-8bec-b1987f11c4a2
2007-12-07 00:26:56 +00:00

36 lines
598 B
C++

#include <string.h>
#include "Utils.h"
using namespace Framework;
using namespace std;
void Utils::GetLine(CStream* pS, string* pStr, bool nIgnoreCR)
{
unsigned char nChar;
(*pStr) = "";
pS->Read(&nChar, 1);
while(!pS->IsEOF())
{
if(!(nIgnoreCR && (nChar == '\r')))
{
(*pStr) += nChar;
}
pS->Read(&nChar, 1);
if(nChar == '\n') break;
}
}
const char* Utils::GetFilenameFromPath(const char* sPath, char nSeparator)
{
const char* sTemp;
sTemp = strchr(sPath, nSeparator);
while(sTemp != NULL)
{
sPath = sTemp + 1;
sTemp = strchr(sPath, nSeparator);
}
return sPath;
}