2007-12-07 00:26:56 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include "Utils.h"
|
|
|
|
|
2014-05-23 00:39:22 -04:00
|
|
|
std::string Utils::GetLine(Framework::CStream* stream, bool nIgnoreCR)
|
2007-12-07 00:26:56 +00:00
|
|
|
{
|
2014-05-23 00:39:22 -04:00
|
|
|
std::string result;
|
|
|
|
unsigned char nChar = 0;
|
|
|
|
stream->Read(&nChar, 1);
|
|
|
|
while(!stream->IsEOF())
|
2007-12-07 00:26:56 +00:00
|
|
|
{
|
2015-04-18 22:16:41 -04:00
|
|
|
if(nChar == '\n') break;
|
2007-12-07 00:26:56 +00:00
|
|
|
if(!(nIgnoreCR && (nChar == '\r')))
|
|
|
|
{
|
2014-05-23 00:39:22 -04:00
|
|
|
result += nChar;
|
2007-12-07 00:26:56 +00:00
|
|
|
}
|
2014-05-23 00:39:22 -04:00
|
|
|
stream->Read(&nChar, 1);
|
2007-12-07 00:26:56 +00:00
|
|
|
}
|
2014-05-23 00:39:22 -04:00
|
|
|
return result;
|
2007-12-07 00:26:56 +00:00
|
|
|
}
|