adding spaces

This is a discussion on adding spaces within the C++ Programming forums, part of the General Programming Boards category; 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++ ...

  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,794
    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-21-2008, 11:51 PM
  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, 02:44 PM
  4. Handling spaces in command line arguments
    By starkhorn in forum C++ Programming
    Replies: 7
    Last Post: 11-16-2004, 01:42 PM
  5. Adding dynamic spaces
    By Snowtion in forum C Programming
    Replies: 5
    Last Post: 03-27-2003, 06:53 PM

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