ifstream whole file

This is a discussion on ifstream whole file within the C++ Programming forums, part of the General Programming Boards category; This probably isn't the first time this question has been asked, but how do you input an entire txt file ...

  1. #1
    Road233
    Guest

    ifstream whole file

    This probably isn't the first time this question has been asked, but how do you input an entire txt file to an array and then print it out, using ifstream?

  2. #2
    Registered User ski6ski's Avatar
    Join Date
    Aug 2001
    Posts
    133
    ifstream only reads files in
    ofstream puts files out

    First get the location of the file to be read in with ifstream
    Store the file into a buffer or array
    Create or open a different file (can be .txt or any other)
    Read the buffer or array out to the new file usint ofstream

    That is basicly how I would do it. Coding it could get quite tireing though.
    C++ Is Powerful
    I use C++
    There fore I am Powerful

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  2. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  3. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM

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