Thread: adding spaces

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    128

    adding spaces

    I'm creating a space-delimited file.
    In another language, I'm used to using Space(n) to add n-number of spaces.

    Does c++ have anything similiar? Google isn't doing well for me.

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Writes 20 spaces to cout:
    Code:
    #include <iostream>
    #include <string>
    
    ...
    
    std::cout << std::string(20,' ');
    You can easily do the same with a file.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    128
    perfect, thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Changing 3 spaces to tabs
    By dnguyen1022 in forum C Programming
    Replies: 2
    Last Post: 12-22-2008, 12:51 AM
  2. Tabs or Spaces
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 46
    Last Post: 04-08-2007, 11:45 AM
  3. SVN Import Causes Crash
    By Tonto in forum Tech Board
    Replies: 6
    Last Post: 11-01-2006, 03:44 PM
  4. Handling spaces in command line arguments
    By starkhorn in forum C++ Programming
    Replies: 7
    Last Post: 11-16-2004, 02:42 PM
  5. Adding dynamic spaces
    By Snowtion in forum C Programming
    Replies: 5
    Last Post: 03-27-2003, 07:53 PM