Multiple Strings

This is a discussion on Multiple Strings within the C++ Programming forums, part of the General Programming Boards category; I know how to use strcpy() but I can't figure out how to take multiple string and merge them into ...

  1. #1
    Unregistered
    Guest

    Multiple Strings

    I know how to use strcpy() but I can't figure out how to take multiple string and merge them into 1.

  2. #2
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    801
    Do you mean like strcat()?

    It concatenates one string onto the end of another.

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    used like this:
    Code:
    #include <stdio.h>
    #include <string.h>
    
    int main ()
    {
      char str[80];
      strcpy (str,"d0");
      strcat (str,"0b");
      puts (str);
      return 0;
    }

  4. #4
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    801
    Very good of you d00b to give an example but I was kinda hoping my post would prompt them to research strcat() themself. Best way to learn I think.

  5. #5
    Registered User
    Join Date
    Jun 2002
    Posts
    267

  6. #6
    elad
    Guest
    IF you have STL then it's a simple call to the overloaded + or += operators in the string class. If you're like me, you're stuck with strcat(). Darn.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading Multiple Multi-Part Strings From a Text File
    By bengreenwood in forum C++ Programming
    Replies: 2
    Last Post: 06-02-2009, 10:43 AM
  2. Splittig a string into multiple strings
    By Evenstevens in forum C Programming
    Replies: 7
    Last Post: 04-09-2009, 12:38 PM
  3. multiple nak strings
    By bhorrobi in forum C++ Programming
    Replies: 2
    Last Post: 08-09-2004, 12:44 PM
  4. bubble sorting multiple strings
    By jibbles in forum C Programming
    Replies: 10
    Last Post: 10-11-2003, 11:48 PM
  5. combining multiple strings into 1 string
    By Leeman_s in forum C++ Programming
    Replies: 3
    Last Post: 01-27-2003, 08:49 PM

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