:

PRINT FILE

Added by: ~lll67, 2018 X 01

Added by: ~lll67, 2018 X 01

Hello, I'm trying to print the results in a file like this :

int _tmain(int argc, _TCHAR* argv[])
{
int nb, n, p, nbp, r, m;
int cste, cst, tr;

FILE * pFile = NULL;
pFile = fopen ("Test.txt","w");

ttmath::UInt<30> a,b;
MyInt a, b, c, res;
a = 27;
b = 28;
a.Pow(b);
fprintf(pFile,"N = %d", a);
...

The result in the file is -2652......

and with fprintf(pFile,"N = %s", a.ToString());
the result is lü...

Is there a specific syntax ? %??? like %i %s

Thanks
Excuse me i'm french and my english is not well...

Added by: tomek, 2018 X 01, Last modified: 2018 X 01

You can print it in this way:

a = 27;
b = 28;
a.Pow(b);

std::string astr = a.ToString();
fprintf(pFile,"N = %s", astr.c_str());