add FileReading::ReadString

This commit is contained in:
Glenn Maynard
2005-05-18 06:38:25 +00:00
parent 198dbbd6c9
commit 41682c11e3
2 changed files with 15 additions and 0 deletions
+14
View File
@@ -216,6 +216,20 @@ void FileReading::ReadBytes( RageFileBasic &f, void *buf, int size, CString &sEr
sError = "Unexpected end of file";
}
CString FileReading::ReadString( RageFileBasic &f, int size, CString &sError )
{
if( sError.size() != 0 )
return "";
CString sBuf;
int ret = f.Read( sBuf, size );
if( ret == -1 )
sError = f.GetError();
else if( ret < size )
sError = "Unexpected end of file";
return sBuf;
}
void FileReading::SkipBytes( RageFileBasic &f, int iBytes, CString &sError )
{
if( sError.size() != 0 )
+1
View File
@@ -87,6 +87,7 @@ namespace FileReading
void ReadBytes( RageFileBasic &f, void *buf, int size, CString &sError );
void SkipBytes( RageFileBasic &f, int size, CString &sError );
void Seek( RageFileBasic &f, int iOffset, CString &sError );
CString ReadString( RageFileBasic &f, int size, CString &sError );
uint8_t read_8( RageFileBasic &f, CString &sError );
int16_t read_16_le( RageFileBasic &f, CString &sError );
uint16_t read_u16_le( RageFileBasic &f, CString &sError );