reading input from file

This is a discussion on reading input from file within the C Programming forums, part of the General Programming Boards category; My integer and float values will not show up. Only the string values. What am I doing wron here. Here ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    5

    Cool reading input from file

    My integer and float values will not show up. Only the string values. What am I doing wron here.





    Here is my data. The code has been attatched.

    1000 Hammers 24 12 24 4.75 9.49
    2000 Saws 08 16 12 7.50 14.99
    3000 Drills 10 12 18 7.83 15.95
    4000 Screwdrivers 36 24 12 2.27 4.98
    5000 Pliers 12 12 36 2.65 5.49
    Attached Files Attached Files
    • File Type: c 7-4.c (2.0 KB, 85 views)

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    printf("%4d %-15s %2d %2d%4.2f \n",
    &itemnum,description,&qoh,&req,&cost);
    return;
    Do not use the & operator when using printf. The '&' is in this usage the "address of" operator. You do not need this in printf. And in fact, using it is wrong here.

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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-02-2009, 06:27 AM
  2. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  3. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  4. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

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