add FileReading::ReadString
This commit is contained in:
@@ -216,6 +216,20 @@ void FileReading::ReadBytes( RageFileBasic &f, void *buf, int size, CString &sEr
|
|||||||
sError = "Unexpected end of file";
|
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 )
|
void FileReading::SkipBytes( RageFileBasic &f, int iBytes, CString &sError )
|
||||||
{
|
{
|
||||||
if( sError.size() != 0 )
|
if( sError.size() != 0 )
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ namespace FileReading
|
|||||||
void ReadBytes( RageFileBasic &f, void *buf, int size, CString &sError );
|
void ReadBytes( RageFileBasic &f, void *buf, int size, CString &sError );
|
||||||
void SkipBytes( RageFileBasic &f, int size, CString &sError );
|
void SkipBytes( RageFileBasic &f, int size, CString &sError );
|
||||||
void Seek( RageFileBasic &f, int iOffset, 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 );
|
uint8_t read_8( RageFileBasic &f, CString &sError );
|
||||||
int16_t read_16_le( RageFileBasic &f, CString &sError );
|
int16_t read_16_le( RageFileBasic &f, CString &sError );
|
||||||
uint16_t read_u16_le( RageFileBasic &f, CString &sError );
|
uint16_t read_u16_le( RageFileBasic &f, CString &sError );
|
||||||
|
|||||||
Reference in New Issue
Block a user