Re: [gtkmm] behavior modification of input/output functions



Florent Teichteil wrote:
Hi,

I have a problem with input/output operations with gtkmm.

I wrote this piece of code in a graphical application using gtkmm 2.2.1
:

double probability;
printf("p = ");
scanf("%lf", &probability);
printf("\np = %lf\n", probability);

1) First test with 3.56 :

p = 3.56
p = 3,000000

2) Second test with 3,56 :

p = 3,56
p = 3,560000

I was very surprised since I should obtain the opposite result.

Indeed, the same piece of code in a console application returns the
opposite results :

1) First test with 3.56 :

p = 3.56
p = 3.560000


2) Second test with 3,56 :

p = 3,56
p = 3,000000

Therefore, I think that gtkmm modifies the behavior of the functions of
<cstdio>. If so, how can I prevent this modification ?

I think it more likely that your first example is compiled in C++ and the second in C, I doubt that gtkmm is at fault.

Also suggest you look into using iostreams for I/O, unless you're working with legacy code.

Cheers,
Tim



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]