Thread: copying files

  1. #1

    copying files

    im having trouble learning the whole data file stuff... what i want to do is copy a text file.. lets say the name be "stuff.txt" . and im tryin to figure out a way to copy that file and removes any blank spaces in the file. im tryin to go about this in simple commands.. so that i actaully learn it.. like ifstream infile; kind of stuff.
    i would really appreciate anyones help! thx

  2. #2
    I'm Back
    Join Date
    Dec 2001
    for the problem of copying file you could do something like this

    ifstream infile;
    ofstream outfile;"stuff.txt");"stuff2.txt');



    as for removing the spaces you could do this in the while loop

    if(data!=' ')

    hope this helps

  3. #3
    using << and >> will remove whitespaces because they are not included as part of the input. If you have multiple data types in the file, this method will not work.

    you could input one character at a time from the file and then output that character to the new file if it isn't a whitespace.
    remember that \n is also a whitespace character

  4. #4
    I'm Back
    Join Date
    Dec 2001
    use infile.get(data)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. using mmap for copying large files
    By rohan_ak1 in forum C Programming
    Replies: 6
    Last Post: 05-13-2008, 08:12 AM
  2. accessing all files in a folder.
    By pastitprogram in forum C++ Programming
    Replies: 15
    Last Post: 04-30-2008, 10:56 AM
  3. Copying Files
    By HLA91 in forum C++ Programming
    Replies: 8
    Last Post: 10-25-2007, 03:24 AM
  4. Help with loading files into rich text box
    By blueparukia in forum C# Programming
    Replies: 3
    Last Post: 10-19-2007, 12:59 AM
  5. Copying binary files, like ZIPs
    By frenchfry164 in forum C++ Programming
    Replies: 4
    Last Post: 03-16-2002, 02:54 PM
Website Security Test