Thread: string variable + "some string" ??

  1. #1
    Registered User
    Join Date
    Mar 2005

    string variable + "some string" ??

    How can I add an "string" to a string variable to make it into one big string? I have code that returns the current path of the program:

    char cDir[150];

    Now I need to open a file within this folder, however I need to add the filename at the end of cDir:

    char szPath[] = cDir & "AnnualPlan.txt"; -this doesn't work, I also tried it with a + and nothing, it gives error:

    "invalid operands to binary +"

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    You can't add strings. You can concatenate them, provided you have enough room. Consider strcat. You'll want to read up on all of the string functions.

    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. Calculator + LinkedList
    By maro009 in forum C++ Programming
    Replies: 20
    Last Post: 05-17-2005, 12:56 PM
  3. can anyone see anything wrong with this code
    By occ0708 in forum C++ Programming
    Replies: 6
    Last Post: 12-07-2004, 12:47 PM
  4. Variable Allocation in a simple operating system
    By awkeller in forum C Programming
    Replies: 1
    Last Post: 12-08-2001, 02:26 PM