I've started using SystemC
recently and wanted to write a simple program that reads numbers from a file in the SystemC
string format and converts them into sc_uint
types. Somehow the simple program always fails during the conversion
The program:
#include <systemc.h>
#include <fstream>
#include <string>
int sc_main( int argc, char *argv[] ){
ifstream in_file;
std::string line;
char *buffer;
in_file.open( "ex3_2.dat", ios::in );
while( getline( in_file, line ) ){
sc_uint<29> x = line.c_str();
}
return( 0 );
}
The ex3_2.dat file
0x1234\n
The output
Error: (E403) conversion failed: character string is empty
I do not get why the conversion breaks.
c_str() should return a const char*.
Printing the String to cout shows the right value for line.
Static assignments like "0x1234" do work. Does somebody have an idea?