12 #ifndef PS_FILEBUFFER_HXX
13 #define PS_FILEBUFFER_HXX
44 unsigned long int total_read;
45 unsigned long int total_write;
52 static const bool READONLY =
true;
53 static const bool WRITEONLY =
false;
61 void put (
const void *_data,
int _length);
62 void get (
void *_data,
int _length);
63 void peek(
void *_data,
int _length);
68 fprintf(stderr,
"sorry, i can't write to files opened readonly\n");
71 if (size+1 < BUFFER_SIZE) {
82 if (position < size) {
83 _c = buffer[position];
93 if (position < size) {
94 return buffer[position++];
104 void put_ulong(
unsigned long int _ul);
105 void get_ulong(
unsigned long int &_ul);
107 unsigned long int ul;
117 unsigned long int ul;
120 _l = -(
long)(ul >> 1);
132 unsigned long int ul;
134 _ui=(
unsigned int)ul;
150 if (!is_readonly)
return false;
151 file_pos = lseek(file_handle, 0, SEEK_CUR);
152 return file_pos >= 0;
156 if (!is_readonly)
return false;
157 if (file_pos < 0)
return false;
158 if (lseek(file_handle, file_pos, SEEK_SET) < 0)
return false;
166 if (size == 0)
return true;
167 return position < size;
184 void reinit(
const char *name,
bool _readonly);
190 if (!is_readonly) flush();
191 if (file_name) free(file_name);
192 if (file_handle != -1) close(file_handle);
194 if (buffer) free(buffer);
200 #error ps_filebuffer.hxx included twice
201 #endif // PS_FILEBUFFER_HXX
void put_char(unsigned char _c)
void get_char(unsigned char &_c)
void put_long(long int _l)
void get_long(long int &_l)
char buffer[MESSAGE_BUFFERSIZE]
void put_uint(unsigned int _ui)
void get_uint(unsigned int &_ui)