A Silly Question!

This is a discussion on A Silly Question! within the C++ Programming forums, part of the General Programming Boards category; Hello, Well This is My first Post so well.... Nerver Mind.... Question - I want to put to char* variables ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Location
    England, Norwich
    Posts
    38

    Lightbulb A Silly Question!

    Hello,

    Well This is My first Post so well.... Nerver Mind....

    Question -

    I want to put to char* variables and make them into

    e.g.

    char* bla1
    and
    char* bla2
    and
    char* bla

    i want bla to have bla1 folowed by bla2 for its data

    anyideas

    Could Some body answer this Silly Dum Question PLEASE!!

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,344
    If you want to combine character arrays, you use strcat to concatenate them, but you have to make sure that the size of bla is big enough to hold bla1, bla2 and a null terminator.

    However, in C++ you should be using the C++ string class for your strings. They are much easier to use and more difficult to misuse. This is the perfect example. If you had string bla1 and bla2 and wanted to combine them, you would just use bla = bla1 + bla2.

  3. #3
    Registered User
    Join Date
    Jan 2006
    Location
    England, Norwich
    Posts
    38

    Cool

    OK,

    That works Perfect.

    Thank You very very very much.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Silly question but..
    By swgh in forum C++ Programming
    Replies: 3
    Last Post: 05-05-2008, 01:39 PM
  2. A silly question but it's my doubt ;)
    By chottachatri in forum C++ Programming
    Replies: 19
    Last Post: 04-23-2008, 02:26 PM
  3. Really quick silly question.
    By Jozrael in forum C++ Programming
    Replies: 36
    Last Post: 04-04-2008, 09:31 AM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 10:47 PM
  5. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM

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