Closed Thread
Results 1 to 3 of 3

Thread: Formatting Text in a text file help?

  1. #1
    Djanvk is offline Newbie
    Join Date
    Aug 2008
    Location
    Illinois
    Posts
    6
    Rep Power
    0

    Formatting Text in a text file help?

    I am outputting a bunch of number to a text file and they just keep going in that text file on one line. Is there a way to make it do wordwrap or to have the numbers go to another line after it prints say 10 numbers?

    Thanks for any input.

    Doug

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    telboon is offline Newbie
    Join Date
    May 2008
    Posts
    26
    Rep Power
    0

    Re: Formatting Text in a text file help?

    If you want to go to the next line, just print a "\n" or endl.

    inFile<<endl;

    or

    inFile<<"\n";

    For it to go a new line after every 10 numbers, you could do a loop or something.

    Example:
    Code:
    for (int i=0;i<total;i++)                       //A for loop to go through all number
    {
        cout<<num[i];                             //Outputs Number
        if ((i%10==0) && (i!=0)) cout<<endl;  // Check if it's every 10 number. Print line if it is
    }
    Last edited by telboon; 08-17-2008 at 10:53 AM.

  4. #3
    Join Date
    May 2008
    Posts
    2,126
    Blog Entries
    1
    Rep Power
    33

    Re: Formatting Text in a text file help?

    Use the code tags dude.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. MSGBOX text formatting
    By HighKing Scott in forum Visual Basic Programming
    Replies: 3
    Last Post: 11-03-2011, 01:15 AM
  2. Formatting cells in Excel to be text.
    By Blue Indian in forum C# Programming
    Replies: 3
    Last Post: 07-20-2011, 02:03 PM
  3. How can I let the text inside a text file ...
    By xxxxjayxxx in forum Java Help
    Replies: 1
    Last Post: 03-13-2011, 04:31 AM
  4. Formatting text (Short Code)
    By photoScan in forum C# Programming
    Replies: 0
    Last Post: 10-24-2010, 01:23 PM
  5. AS: Formatting Text Fields
    By chili5 in forum Tutorials
    Replies: 3
    Last Post: 08-29-2009, 07:10 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts