×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    3

    Is this a bug with "printf()" and "fprintf()"in open C?

    Hi,

    I just found a problem when using "printf" function in Open C using N95. If anyone can help me, please advice.

    Say I want to display some vairables' value with the following code:

    double x = 9.0
    float y = 8.005;
    double z = 4.01;

    printf("x = %f \n", x);
    printf("y = %f \n", y);
    printf("z = %f \n", z);

    Instead of showing the exact value, the output is actually shown as the following:
    x = 9..000000
    y = 8..050000
    z = 4.0100000

    For some reason, two dots are displayed for some variable (i.e. x and y).

    You can easily repeat the problem. Just create a regular symbian project in Carbide C++ and then put the above code somewhere. I put the code in the application view constructor.

    The same problem also occurs when using fprintf(), which prevents me from saving float point data into a text file correctly. If anyone can give me some advice, I'd be very thankful.

    -Shawn

  2. #2
    Registered User
    Join Date
    Dec 2006
    Posts
    2,280

    Re: Is this a bug with "printf()" and "fprintf()"in open C?

    Hi,

    This is definitely a bug. A new version of Open C is due out very soon. If it's still broken with that then you should report it as a bug.

    In the mean time, I think your only alternative is to convert the numbers to strings yourself and print those.

    Mark

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    3

    Re: Is this a bug with "printf()" and "fprintf()"in open C?

    Mark, thank you very much for the information.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×