Lines 63-79
public:
Link Here
|
63 |
} |
63 |
} |
64 |
|
64 |
|
65 |
int read(void *buffer, size_t size, size_t count) { |
65 |
int read(void *buffer, size_t size, size_t count) { |
66 |
if(substream) return substream->read(buffer, size, count); |
|
|
67 |
return _io->read_proc(buffer, (unsigned)size, (unsigned)count, _handle); |
66 |
return _io->read_proc(buffer, (unsigned)size, (unsigned)count, _handle); |
68 |
} |
67 |
} |
69 |
|
68 |
|
70 |
int seek(INT64 offset, int origin) { |
69 |
int seek(INT64 offset, int origin) { |
71 |
if(substream) return substream->seek(offset, origin); |
|
|
72 |
return _io->seek_proc(_handle, (long)offset, origin); |
70 |
return _io->seek_proc(_handle, (long)offset, origin); |
73 |
} |
71 |
} |
74 |
|
72 |
|
75 |
INT64 tell() { |
73 |
INT64 tell() { |
76 |
if(substream) return substream->tell(); |
|
|
77 |
return _io->tell_proc(_handle); |
74 |
return _io->tell_proc(_handle); |
78 |
} |
75 |
} |
79 |
|
76 |
|
Lines 83-95
public:
Link Here
|
83 |
|
80 |
|
84 |
int get_char() { |
81 |
int get_char() { |
85 |
int c = 0; |
82 |
int c = 0; |
86 |
if(substream) return substream->get_char(); |
|
|
87 |
if(!_io->read_proc(&c, 1, 1, _handle)) return -1; |
83 |
if(!_io->read_proc(&c, 1, 1, _handle)) return -1; |
88 |
return c; |
84 |
return c; |
89 |
} |
85 |
} |
90 |
|
86 |
|
91 |
char* gets(char *buffer, int length) { |
87 |
char* gets(char *buffer, int length) { |
92 |
if (substream) return substream->gets(buffer, length); |
|
|
93 |
memset(buffer, 0, length); |
88 |
memset(buffer, 0, length); |
94 |
for(int i = 0; i < length; i++) { |
89 |
for(int i = 0; i < length; i++) { |
95 |
if(!_io->read_proc(&buffer[i], 1, 1, _handle)) |
90 |
if(!_io->read_proc(&buffer[i], 1, 1, _handle)) |
Lines 104-110
public:
Link Here
|
104 |
std::string buffer; |
99 |
std::string buffer; |
105 |
char element = 0; |
100 |
char element = 0; |
106 |
bool bDone = false; |
101 |
bool bDone = false; |
107 |
if(substream) return substream->scanf_one(fmt,val); |
|
|
108 |
do { |
102 |
do { |
109 |
if(_io->read_proc(&element, 1, 1, _handle) == 1) { |
103 |
if(_io->read_proc(&element, 1, 1, _handle) == 1) { |
110 |
switch(element) { |
104 |
switch(element) { |
Lines 127-133
public:
Link Here
|
127 |
} |
121 |
} |
128 |
|
122 |
|
129 |
int eof() { |
123 |
int eof() { |
130 |
if(substream) return substream->eof(); |
|
|
131 |
return (_io->tell_proc(_handle) >= _eof); |
124 |
return (_io->tell_proc(_handle) >= _eof); |
132 |
} |
125 |
} |
133 |
|
126 |
|