I'm trying to export and import a NTL vector from type ZZ_pX. After Reading the source code i found this interesting operator functions:
istream& operator>>(istream& s, ZZ_pX& x)
{
NTL_INPUT_CHECK_RET(s, s >> x.rep);
x.normalize();
return s;
}
ostream& operator<<(ostream& s, const ZZ_pX& a)
{
return s << a.rep;
}
then i wrote this code for exporting :
ZZ_pX phi;
ofstream myfile;
myfile.open ("phi.txt");
myfile << phi;
myfile.close();
and for the importing i tried to do something like this :
ZZ_pX phi;
std::ifstream dataFile("phi.txt");
while (!dataFile.fail() && !dataFile.eof() )
{
dataFile >> phi ;
cout << phi;
}
The exporting is working but not the importing, error:
ZZ_p constructor called while modulus undefined
Aborted (core dumped)
Sorry if this is very simple as I quite new to C++