Y
Yahooooooooo
Just practicing BOOST regular expressions....giving errors...
-- wanted to replace SPACE with NULL.
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <iterator>
#include <boost/regex.hpp>
#include <fstream>
#include <iostream>
using namespace std;
boost::regex rex1;
extern const char* pre_expression= " ";
extern const char* pre_format="";
int main(void)
{
string line;
//boost::regex rex1(" ",boost::regex:
erl|boost::regex::icase);
rex1.assign(pre_expression);
boost::regex rex2;
ifstream fh("/tmp/log.conf");
getline(fh,line);
cout << line << endl;
std:
stringstream osstr(std::ios:
ut);
std:
stream_iterator<char,char> oi(osstr);
boost::regex_replace(oi,line.begin(),line.end(),rex1,pre_format,boost::
match_default | boost::format_all);
getline(fh,line);
cout << line << endl;
fh.close();
return 1;
}
##### g++ -o runme -ftemplate-depth-100 -I/home/azmath/dev/
boost_1_33_1/ -DBOOST_USER_CONFIG="</home/azmath/dev/boost_1_33_1/
boost/config/user.hpp>" -lboost_regex-gcc-d-1_33_1 classreadfile.cc
In file included from /home/azmath/dev/boost_1_33_1/boost/regex/v4/
regex.hpp:55,
from /home/azmath/dev/boost_1_33_1/boost/regex.hpp:
31,
from classreadfile.cc:6:
/home/azmath/dev/boost_1_33_1/boost/regex/v4/char_regex_traits.hpp: In
instantiation of
`boost::regex_traits<char,boost::cpp_regex_traits<char> >':
/home/azmath/dev/boost_1_33_1/boost/regex/v4/char_regex_traits.hpp:
38: instantiated from here
/home/azmath/dev/boost_1_33_1/boost/regex/v4/char_regex_traits.hpp:38:
base class `boost::cpp_regex_traits<char>' has incomplete type
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp: In
instantiation of
`boost::basic_regex<char,boost::regex_traits<char,boost::cpp_regex_trai
ts<char> > >':
classreadfile.cc:14: instantiated from here
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:186: no
type named `size_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:187: no
type named `string_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:202: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:530: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:530: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:339: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp: In
method `class
boost::basic_regex<char,boost::regex_traits<char,boost::cpp_regex_trait
s<char> > > &
boost::basic_regex<char,boost::regex_traits<char,boost::cpp_regex_trait
s<char> > >::assign(const char *, unsigned int =
boost::regex_constants::normal)':
classreadfile.cc:26: instantiated from here
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:239: no
classreadfile.cc: In function `int main()':
classreadfile.cc:48: wrong number of template arguments (2, should be
1)
/usr/include/g++/stl_iterator.h:875: provided for `template <class
_Tp> ostream_iterator<_Tp>'
classreadfile.cc:48: confused by earlier errors, bailing out
-- wanted to replace SPACE with NULL.
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <iterator>
#include <boost/regex.hpp>
#include <fstream>
#include <iostream>
using namespace std;
boost::regex rex1;
extern const char* pre_expression= " ";
extern const char* pre_format="";
int main(void)
{
string line;
//boost::regex rex1(" ",boost::regex:
rex1.assign(pre_expression);
boost::regex rex2;
ifstream fh("/tmp/log.conf");
getline(fh,line);
cout << line << endl;
std:
std:
boost::regex_replace(oi,line.begin(),line.end(),rex1,pre_format,boost::
match_default | boost::format_all);
getline(fh,line);
cout << line << endl;
fh.close();
return 1;
}
##### g++ -o runme -ftemplate-depth-100 -I/home/azmath/dev/
boost_1_33_1/ -DBOOST_USER_CONFIG="</home/azmath/dev/boost_1_33_1/
boost/config/user.hpp>" -lboost_regex-gcc-d-1_33_1 classreadfile.cc
In file included from /home/azmath/dev/boost_1_33_1/boost/regex/v4/
regex.hpp:55,
from /home/azmath/dev/boost_1_33_1/boost/regex.hpp:
31,
from classreadfile.cc:6:
/home/azmath/dev/boost_1_33_1/boost/regex/v4/char_regex_traits.hpp: In
instantiation of
`boost::regex_traits<char,boost::cpp_regex_traits<char> >':
/home/azmath/dev/boost_1_33_1/boost/regex/v4/char_regex_traits.hpp:
38: instantiated from here
/home/azmath/dev/boost_1_33_1/boost/regex/v4/char_regex_traits.hpp:38:
base class `boost::cpp_regex_traits<char>' has incomplete type
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp: In
instantiation of
`boost::basic_regex<char,boost::regex_traits<char,boost::cpp_regex_trai
ts<char> > >':
classreadfile.cc:14: instantiated from here
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:186: no
type named `size_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:187: no
type named `string_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:202: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:530: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:530: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:339: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<char> >'
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp: In
method `class
boost::basic_regex<char,boost::regex_traits<char,boost::cpp_regex_trait
s<char> > > &
boost::basic_regex<char,boost::regex_traits<char,boost::cpp_regex_trait
s<char> > >::assign(const char *, unsigned int =
boost::regex_constants::normal)':
classreadfile.cc:26: instantiated from here
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:239: no
method `boost::regex_traits said:::length'
classreadfile.cc: In function `int main()':
classreadfile.cc:48: wrong number of template arguments (2, should be
1)
/usr/include/g++/stl_iterator.h:875: provided for `template <class
_Tp> ostream_iterator<_Tp>'
classreadfile.cc:48: confused by earlier errors, bailing out