Thread: Forgive me...

  1. #1
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200

    Forgive me...

    Yes, forgive me for being such an annoying pain in the padded flesh we sit on.

    But one more problem.

    I have the text file like this

    Code:
    blah (
      blah
      blah
    )
    What happens is when I append that to annother file it ends up like this.

    Code:
    blah (blahblah)
    How can I preserve the carriage returns.

  2. #2
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    How are you reading the file in?

  3. #3
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Ok, I use a for loop to read in the file. I do a

    Code:
    for(loop = 0; loop < size_of_file; loop++)   
      FILE >> Buffer[loop];
    then I write it back out the same way.

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    the >> operator will not read in the whitespace char embedded in the file you are reading so they can be transfered to the new file. You will either need to use getline(), or some other method to preserve desired whitespace, or you will have to add them back hard coded.

  5. #5
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    Bah, I figured out why ive been having trouble. The file I need to write to is unicode format.
    Doh...

Popular pages Recent additions subscribe to a feed