I/O Files

This is a discussion on I/O Files within the C++ Programming forums, part of the General Programming Boards category; Anybody, I have been trying to find information on how to declare a global file. Otherwise I would have to ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    184

    I/O Files

    Anybody,

    I have been trying to find information on how to declare a global file. Otherwise I would have to pass file pointers to every function that either reads or writes to the files. I have searched but have not come up with anything. I would appreciate any advise.

    Thanks
    GVector

  2. #2
    Registered User Cela's Avatar
    Join Date
    Jan 2003
    Posts
    362
    C style
    Code:
    #include <cstdio>
    
    FILE *fp;
    
    int main()
    {
      ...
    }
    C++ style
    Code:
    #include <fstream>
    
    using namespace std;
    
    ifstream ifs;
    
    int main()
    {
      ...
    }
    *Cela*

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    184

    Thumbs up I/O Files

    Thank you very much. I really appreciate it. That was so simple I don't see how I missed it, but I have a long way to go. Thanks again,
    GVector

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question: i/o data form .txt or .xls files ??
    By camelman in forum C++ Programming
    Replies: 21
    Last Post: 11-17-2007, 03:48 PM
  2. Folding@Home Cboard team?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 398
    Last Post: 10-11-2005, 09:44 AM
  3. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 04:30 PM
  4. Binary files
    By Lionmane in forum C Programming
    Replies: 35
    Last Post: 08-25-2005, 02:56 PM
  5. I/O with files, deleting.
    By Ezzetabi in forum C++ Programming
    Replies: 1
    Last Post: 03-23-2005, 12:28 PM

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