A
Arturo DiDonna
Hello everyone. I am trying to compile someone else code and I am
stuck with compilation problems using
the g++ 3.3 compiler. Basically, when compiling the following code, I
get this error message:
parsefcns.cc: In function `void get_token(std::ifstream*, char**)':
parsefcns.cc:57: error: cannot convert `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >' to `char*' in
assignment
make: *** [parsefcns.o] Error 1
I don't know C++ and I was wondering if there was a kind soul willing
to help me in solving this problem.
Thanks in advance.
Arturo
...........................................
#include <fstream>
#include <sstream>
#include <cctype>
#include <cstring>
#include <iostream>
using namespace std;
using std::ifstream;
using std:stringstream;
void get_token(std::ifstream *f_stream, char **ch_ptr)
{
char ch;
std:stringstream buffer;
while( (f_stream->get(ch)) &&
(!isspace(ch)) &&
(!f_stream->eof()) )
{
buffer << ch;
}
buffer << '\0';
(*ch_ptr) = buffer.str(); // This is the line giving compilation
problems
// return ch;
f_stream->seekg(-1, std::ios::cur);
}
.............etc.
stuck with compilation problems using
the g++ 3.3 compiler. Basically, when compiling the following code, I
get this error message:
parsefcns.cc: In function `void get_token(std::ifstream*, char**)':
parsefcns.cc:57: error: cannot convert `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >' to `char*' in
assignment
make: *** [parsefcns.o] Error 1
I don't know C++ and I was wondering if there was a kind soul willing
to help me in solving this problem.
Thanks in advance.
Arturo
...........................................
#include <fstream>
#include <sstream>
#include <cctype>
#include <cstring>
#include <iostream>
using namespace std;
using std::ifstream;
using std:stringstream;
void get_token(std::ifstream *f_stream, char **ch_ptr)
{
char ch;
std:stringstream buffer;
while( (f_stream->get(ch)) &&
(!isspace(ch)) &&
(!f_stream->eof()) )
{
buffer << ch;
}
buffer << '\0';
(*ch_ptr) = buffer.str(); // This is the line giving compilation
problems
// return ch;
f_stream->seekg(-1, std::ios::cur);
}
.............etc.