WvStreams
Main Page
Modules
Classes
Files
File List
File Members
Docs
sgmlmanual
egfiles
backslashex.cc
1
#include "wvbackslash.h"
2
#include "wvbufbase.h"
3
4
int
main()
5
{
6
WvBackslashEncoder
*enc;
7
enc =
new
WvBackslashEncoder
(
"abcd"
);
8
// enc contains the letters you want to escape (add a backslash to)
9
10
// If you want a decoder, then enc has to be initialiazed like this:
11
// enc = new WvBackslashDecoder();
12
13
WvInPlaceBuf
to_encode(20);
14
WvInPlaceBuf
out(40);
15
16
to_encode.put(
"Test abcdefg"
,12);
17
// to_encode contains the string to be encoded
18
// (added a backslash at the correct spot)
19
20
if
(enc->
encode
(to_encode, out,
true
,
true
))
21
printf (
"This is the result: %s\n"
, (
char
*) out.get(1));
22
23
// Displayed on screen:
24
// This is the result: Test \a\b\c\defg
25
26
return
0;
27
}
Generated on Wed Aug 28 2019 23:57:17 for WvStreams by
1.8.3.1