-
Notifications
You must be signed in to change notification settings - Fork 0
/
charoutput.cpp
85 lines (67 loc) · 1.68 KB
/
charoutput.cpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*Copyright 2001
*
* charoutput.cpp
*
* Author: Gregory Ford greg@reddfish.co.nz
* RTF token parser based on:
* rtf2html by Dmitry Porapov <dpotapov@capitalsoft.com>,
* based on earlier work of Chuck Shotton.
* distributed under BSD-style license
* RTF token lists and hashing algorithm based on
* RTF Tools, Release 1.10
* 6 April 1994
* Paul DuBois dubois@primate.wisc.edu
*
* Copying permitted under GNU licence (see COPYING)
*/
// charoutput.cpp: implementation of the CharOutput class.
//
//////////////////////////////////////////////////////////////////////
#include <string>
#include <iostream>
using namespace std;
#include <stdio.h>
#include "charoutput.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CharOutput::CharOutput()
{
}
CharOutput::~CharOutput()
{
}
int CharOutput::putString(string str)
{
cout << str;
return true;
}
void CharOutput::putChar( char c )
{
cout << c;
}
//////////////////////////////////////////////////////////////////////
// FileCharOutput Class
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
FileCharOutput::~FileCharOutput()
{
if ( fh ) {
fclose( fh );
}
}
FileCharOutput::FileCharOutput(const char *filename)
{
fh = fopen( filename, "w+" );
}
void FileCharOutput::putChar(char c)
{
fputc( c, fh );
}
int FileCharOutput::putString(string str)
{
fputs( str.c_str(), fh);
return true;
}