opening files in a program

This is a discussion on opening files in a program within the C++ Programming forums, part of the General Programming Boards category; The program I'm working on requires me to open a file containing 3 lines each containing a name followed by ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    1

    opening files in a program

    The program I'm working on requires me to open a file containing 3 lines each containing a name followed by a number. I must open the file and read the name in. Then augment .emp to it, to match the files my instructor has. Then open the .emp file and write info to it. My question is how do i open these files, being i don't know the filename ahead of time and they are strings in my program. Any advice or critique of code would be greatly appreciated. Thank you.
    Attached Files Attached Files
    • File Type: c tim.C (2.0 KB, 44 views)
    • File Type: c tim.C (1.6 KB, 40 views)
    Last edited by senyah; 11-03-2011 at 04:17 PM.

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625
    You're passing by value where you should be passing by reference.
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening php files in IE6
    By Micko in forum Tech Board
    Replies: 7
    Last Post: 03-06-2006, 12:16 PM
  2. Opening files...
    By prestomrmime in forum C Programming
    Replies: 4
    Last Post: 07-08-2003, 08:14 PM
  3. Opening Files from c++
    By snowy101 in forum C++ Programming
    Replies: 4
    Last Post: 06-26-2002, 11:33 AM
  4. opening .doc files in unix through C program
    By indira78 in forum Linux Programming
    Replies: 4
    Last Post: 11-05-2001, 11:57 AM
  5. saving files/opening files
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 10-29-2001, 09:16 PM

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