Writing to a file with word wrap?

This is a discussion on Writing to a file with word wrap? within the C++ Programming forums, part of the General Programming Boards category; I have a program I wrote the will send a group of numbers to a text file and when it ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Location
    Freeport, IL
    Posts
    32

    Writing to a file with word wrap?

    I have a program I wrote the will send a group of numbers to a text file and when it does with a large amount of number the all are put on the same line.

    I was wondering if there is any code the will make the like do a word wrap type of thing. Or if I can tell it to move the the next line after writing 10 number to a row.

    Thanks for any help.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    Like

    if the number of numbers on this line is greater than 10, print a newline and set the counter back to zero.

    No, there is no concept of "page width", so you need to count the output yourself.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  4. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 02:58 PM

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