home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 June
/
SIMTEL_0692.cdr
/
msdos
/
microcrn
/
issue_40.arc
/
DAIMS.ARC
/
CHBUFFER.HXX
< prev
next >
Wrap
Text File
|
1988-02-10
|
896b
|
30 lines
#include <stream.h>
/*
-*++ class char_buffer: manipulates characters in a buffer
**
** (*++ history:
** 7 Dec 87 Bruce Eckel Creation date
** ++*)
**
** (*++ detailed:
** ++*)
*/
class char_buffer {
int length;
int index; /* for fifo action */
char * head;
public:
char_buffer(int size) { head = new char[length = size + 1]; *head = 0; index = 0;};
~char_buffer() { delete head; };
void error(char * msg) { cerr << msg << "\n"; };
void put(char c); /* put a char at the end of the buffer */
char get(); /* get a char from the end; move end up */
char * str() { return head;};
void dump() { cout << str(); index = 0; *head = 0; };
/* dump to cout and reset to empty */
void erase() { index = 0; *head = 0; };
/* reset to empty */
};