blob: e1d1cf0c0c84f988884e356d099c93e367c77efd (
plain)
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
|
// $Id$
#include "ace/Service_Config.h"
#include "ace/Read_Buffer.h"
ACE_RCSID(Misc, test_read_buffer, "$Id$")
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
ACE_HANDLE handle = argc > 1 ? ACE_OS::open (argv[1], O_RDONLY) : 0;
int term = argc > 2 ? ACE_OS::atoi (argv[2]) : EOF;
int search = argc > 3 ? ACE_OS::atoi (argv[3]) : '\n';
int replace = argc > 4 ? ACE_OS::atoi (argv[4]) : '\0';
ACE_Read_Buffer rb (handle);
char *buf;
while ((buf = rb.read (term, search, replace)) != 0)
{
ACE_OS::write (ACE_STDOUT, buf, rb.size ());
ACE_Allocator::instance ()->free (buf);
}
return 0;
}
|