-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (27 loc) · 881 Bytes
/
main.cpp
File metadata and controls
36 lines (27 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
Author:Rishav Bhowmik
Description:To show some functionalities of OpenSource C++ library buffer.h
*/
#include <iostream>
#include <vector>
#include <fstream>
#include "buffer.h"
using namespace std;
int main(int argc, char const *argv[]) {
int intiger=5; double decimal=2.2222222;
char cstring[] = "HelloBuffer";
//creating new buffer
Buffer buf;
buf.write((char*)(&intiger), sizeof(intiger));
buf.write((char*)(&decimal), sizeof(double));
buf.write((char*)cstring, 12);
cout<<"Size of the buffer:"<<buf._size()<<endl;
int retintiger=5; double retdecimal=2.2;
char retcstring[13];
buf.init_read();/*initialising read stream of the buffer*/
buf.read((char*)(&retintiger), sizeof(intiger));
buf.read((char*)(&retdecimal), sizeof(double));
buf.read(retcstring, 12);
cout<<retintiger<<endl<<retdecimal<<endl<<retcstring<<endl;
return 0;
}