aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-11-02 06:14:41 +0000
committerMike Buland <eichlan@xagasoft.com>2006-11-02 06:14:41 +0000
commitd1e486136db52b466b788c1d81a5c88b6f24acd9 (patch)
tree691724f082670407d386ab6f1e489ee766b592c9 /src/tests
parent73cb610641b9d69aea0f75b6ccd26236e6c8c3fc (diff)
downloadlibbu++-d1e486136db52b466b788c1d81a5c88b6f24acd9.tar.gz
libbu++-d1e486136db52b466b788c1d81a5c88b6f24acd9.tar.bz2
libbu++-d1e486136db52b466b788c1d81a5c88b6f24acd9.tar.xz
libbu++-d1e486136db52b466b788c1d81a5c88b6f24acd9.zip
Added the SBuffer class, a memory buffer that can be used like a stream. Yay!
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/sbuffer.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tests/sbuffer.cpp b/src/tests/sbuffer.cpp
new file mode 100644
index 0000000..d8bbe4d
--- /dev/null
+++ b/src/tests/sbuffer.cpp
@@ -0,0 +1,27 @@
1#include "sbuffer.h"
2
3int main()
4{
5 SBuffer buf;
6
7 buf.write("abcdefg", 7 );
8
9 printf("tell: %d\n", buf.tell() );
10
11 char abuf[6];
12 int nRead;
13 nRead = buf.read( abuf, 5 );
14 abuf[nRead] = '\0';
15 printf("Read %d bytes \"%s\"\n", nRead, abuf );
16
17 buf.setPos( 0 );
18 nRead = buf.read( abuf, 5 );
19 abuf[nRead] = '\0';
20 printf("Read %d bytes \"%s\"\n", nRead, abuf );
21
22 nRead = buf.read( abuf, 5 );
23 abuf[nRead] = '\0';
24 printf("Read %d bytes \"%s\"\n", nRead, abuf );
25
26}
27