mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 20:01:53 +00:00
More comfort functions: read data into a string object.
This commit is contained in:
parent
b36fbf4fd3
commit
e3915fb5da
@ -361,6 +361,23 @@ mm_io_c::puts_unl(const char *s) {
|
||||
return bytes_written;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
mm_io_c::read(string &buffer,
|
||||
size_t size) {
|
||||
char cbuffer[size + 1];
|
||||
int nread;
|
||||
|
||||
nread = read(buffer, size);
|
||||
if (nread < 0)
|
||||
buffer = "";
|
||||
else {
|
||||
cbuffer[nread] = 0;
|
||||
buffer = cbuffer;
|
||||
}
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
mm_io_c::read_uint8() {
|
||||
unsigned char value;
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
virtual void setFilePointer(int64 offset, seek_mode mode = seek_beginning);
|
||||
virtual bool setFilePointer2(int64 offset, seek_mode mode = seek_beginning);
|
||||
virtual uint32 read(void *buffer, size_t size);
|
||||
virtual uint32_t read(string &buffer, size_t size);
|
||||
virtual unsigned char read_uint8();
|
||||
virtual uint16_t read_uint16();
|
||||
virtual uint32_t read_uint24();
|
||||
|
Loading…
Reference in New Issue
Block a user