Problem with Pacific C...

This is a discussion on Problem with Pacific C... within the C Programming forums, part of the General Programming Boards category; I have Pacific C installed on my laptop, and it has begun to act a little strangly. If I try ...

  1. #1
    Utter insanity
    Join Date
    Jan 2004
    Posts
    19

    Problem with Pacific C...

    I have Pacific C installed on my laptop, and it has begun to act a little strangly. If I try to use the Float or Scientific notation format specifiers, the program, after linked, works except that instead of the number specified, it comes up with "Non float printf" Here's a sample code:

    Code:
    #include <stdio.h>
    
    main()
    {
           double num;
    
           num = 123456;
           printf("Yadda yadda: %e\n", num);
           return 0;
    }
    This will compile, link, and execute fine, but the result is like this:

    Yadda yadda: (non-float printf)

    It doesn't do this in Dev C\C++. Is there a way to fix this without re-installing the IDE, or will I have to find another copy? My laptop is a bit old (486) and won't run most of the IDEs I've found, either due to lack of Hard drive space, or RAM. Thanks.
    "I merely took the energy it takes to pout and wrote some blues." - Duke Ellington

  2. #2
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463
    I can't really answer your question because I've never heard of the IDE, maybe try %l (it's worked for me before in MSVC, I dont know if it's correct use) but another IDE you could try is the gcc/rhide combo from the DJGPP website. I like it a lot, it's small, and should work fine on your older computer.

  3. #3
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Yadda yadda: (non-float printf)
    Could you be a bit more specific? I have no idea what you mean by that.
    hello, internet!

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    It is simply amazing what you can find with a two second search on Google. For example, look at the first hit! Or even better, the second hit gives you, wait for it, THE PACIFIC C FAQ!!! *reels in shock*

    Teach the ignorant to search, and you feed them for a lifetime. Or something like that.

    [edit] Needed more color in this post. [/edit]

    Quzah.
    Last edited by quzah; 09-07-2004 at 07:48 PM.
    Hope is the first step on the road to disappointment.

  5. #5
    Utter insanity
    Join Date
    Jan 2004
    Posts
    19
    quzah - Build a man a fire, and he will be warm for a night. Set a man on fire, he will be warm for life, eh?

    I did dig through the company that made the IDE's website. Unfortunately, I found about as much there as I did by kicking rocks. First thing, I was using scientific notation format specifier in the sample prog, and I've used both 123.456789 and other weird numbers for it before. Still didn't work properly. Second link does about the same. I'll repeat, this is a problem with the %e, %E, and %F format specifiers (I haven't made it any farther in the book. I want to get this fixed as soon as possible). My code works with Dev C/C++, which is on this computer, a WinXP machine. The original program that failed is in a SAMs book, whichever edition is about 4 years old. It used both the %e and %F specifiers. General specifics escape me (not sure what the text was supposed to say, nor exactly what numbers they may be), but here's something similar:
    Code:
    #include <stdio.h>
    
    main()
    {
          double flt_num;
          int int_num;
    
          int_num = 123;
          flt_num = 123.456789;
          printf("blah blah blah: %e\n", int_num);
          printf("Yakkity yakkity yak: %f\n", flt_num);
          return 0;
    }
    Same thing, (non-float printf) at the end of each line. I don't have a working copy anywhere else; no need for it on this comp, and I made the mistake of backing it up on an Imation floppy, which has had a habit lately of eating things.
    Thanks for the links.

    moi - That's what pops up when you run the "program" (not much of one). And I don't know what that means either.

    Draco - I tried that on an even older comp before. I'll try it again, possibly, but I'm slightly distrustful of it. Thanks.
    Last edited by domhnall4h; 09-07-2004 at 08:56 PM.
    "I merely took the energy it takes to pout and wrote some blues." - Duke Ellington

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Well, I suppose it helps if you actually read:
    25. Using %f in printf does not work

    Q: I have a printf call like:



    printf("number=%f\n");



    but the output is 'number=(non-float printf)'. What am I doing wrong?



    A: In HPD you must set "Options/Float formats in printf" or from the command

    line use a -LF option to include the floating point library. The default

    library does not include floating point support for printf
    , to reduce the

    code size.
    I'd make it flash and play horns, but the forum doesn't support either of those.

    Quzah.
    Hope is the first step on the road to disappointment.

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,451
    Like most ancient DOS compilers, its a little too keen to kick out all the floating point code, because historically, all floating point was done using library code (unless you could afford the then very expensive separate 8087 math co processor).
    Unfortunately, the compiler isn't always that smart at spotting when you've actually used floating point, especially in simple test code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Utter insanity
    Join Date
    Jan 2004
    Posts
    19
    *checks glasses* Maybe I need to go with something easy, like knitting. Thanks, y'all.
    "I merely took the energy it takes to pout and wrote some blues." - Duke Ellington

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21