Thread: Appending strings

  1. #1
    Registered User Ajsan's Avatar
    Join Date
    Dec 2003
    Posts
    55

    Appending strings

    i would like to be able to add characters to the end of a string suck as

    string funString;
    funString="asdfffjds"; //whatever inside the quotes
    //add .txt to string so that its
    funString="asdfffjds.txt";
    Style is overrated.

    - —₽‚¢‰Î -

  2. #2
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    Code:
    funString += ".txt";
    make sure to include <string>
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Note that you can only add characters and strings using +=. To add numbers n such you have to use a stringstream.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    Registered User Ajsan's Avatar
    Join Date
    Dec 2003
    Posts
    55

    thx

    thx for the help guys or gals
    Style is overrated.

    - —₽‚¢‰Î -

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strings Program
    By limergal in forum C++ Programming
    Replies: 4
    Last Post: 12-02-2006, 03:24 PM
  2. Programming using strings
    By jlu0418 in forum C++ Programming
    Replies: 5
    Last Post: 11-26-2006, 08:07 PM
  3. Appending Strings
    By Fuyuki in forum C++ Programming
    Replies: 4
    Last Post: 11-17-2005, 11:38 AM
  4. Reading strings input by the user...
    By Cmuppet in forum C Programming
    Replies: 13
    Last Post: 07-21-2004, 06:37 AM
  5. menus and strings
    By garycastillo in forum C Programming
    Replies: 3
    Last Post: 04-29-2002, 11:23 AM