C++ file output question

Discussion in 'OT Technology' started by C5Load, Feb 21, 2006.

  1. C5Load

    C5Load OT Resident UCLA fanatic

    Joined:
    Nov 27, 2001
    Messages:
    11,562
    Likes Received:
    0
    Location:
    Wherever Freddie takes me
    anyone able to tell me why this isn't outputting anything into C:\tax.txt?


    i'm not understanding the whole file input/output thing, and asking the professor doesn't do much (death by powerpoint kind of teacher)
     
  2. C5Load

    C5Load OT Resident UCLA fanatic

    Joined:
    Nov 27, 2001
    Messages:
    11,562
    Likes Received:
    0
    Location:
    Wherever Freddie takes me

    :rofl: i coulda stared at that for 2 hours and never would have seen it. outputs fine now. thanks a ton.
     
  3. lazyjk

    lazyjk Uncle Sam wants you for the NEW Freedom Fighters!!

    Joined:
    Sep 26, 2005
    Messages:
    5,168
    Likes Received:
    0
    Location:
    Lewistown, Mt
    abbeyroadd's code is correct, can't have the colon, and the slash was wrong.

    you can also just put the filename without a directory, and it will make the file in whatever directory your program is saved in.
     
  4. C5Load

    C5Load OT Resident UCLA fanatic

    Joined:
    Nov 27, 2001
    Messages:
    11,562
    Likes Received:
    0
    Location:
    Wherever Freddie takes me
    good to know... assignment calls for it to be stored there though.
     
  5. Bruticus

    Bruticus half dead OT Supporter

    Joined:
    Apr 10, 2004
    Messages:
    4,608
    Likes Received:
    0
    Location:
    Melbourne
    Also its usually better coding practice to create all the variables before doing any processing (you've done a cout and cin being you've made outData).

    Can keep the code in a bit better shape and easier to follow once it gets large.
     

Share This Page