Concatenate char* 's Error: Invalid operands of types

Hello, I wanted to concatenate 2 static chars's into 1 const char*.
I've tried the + way of doing it.
Same results.

My Code:

static char jj =
"hi"
;

static char pp =
"p"
;

const char *m = jj+pp;

I require it to be char's because i'm using a list of scrolling text on a set of LED strips.
I need help,
Please and Thank You.

revengedeath:
I've tried the + way of doing it.

... which doesn't exist.

Please explain how you intend to use jj, pp, and m. What you posted is totally confusing. Is "user" in quotes because they aren't real, or what? I also don't see any spaces in the example code you posted.

This is getting silly. Just post your entire sketch, in code tags. It's clear to me that your actual problem has nothing to do with the question you posted.

revengedeath:
Hello, I wanted to concatenate 2 static chars's into 1 const char*.

You will have to concatenate the two strings into a char array big enough for them both.

like:

static char jj[] = "hi";
static char pp[] = "p";

#define BUFFER_LEN 20
char buffer[BUFFER_LEN];

strcpy( buffer, jj );  // copy 1st string into buffer
strcat( buffer, pp);  // add in second string

Note that if your 'buffer' array is not big enough to hold both strings, horrid things will happen.
( look up strncpy and strncat )

Yours,
TonyWilk

Where is setup()?

Please add your code as an attachment if it's too big to post.

The answer to your question is in reply #7, but I doubt that the concatenation that you want to do will get you any closer to your objective.

revengedeath:
i tried this but now i get another error. it says it expected a construct or destructor or something before (

Then you screwed up. I compiled it here with no errors. Please post your code as an attachment!

@Tony, OP just cuts and pastes stuff. Needs to be shown exactly where the lines go.

revengedeath:
did u find the error or fix it by chance?

Yeh and no.

I presume this example you've copied did scroll some text... did you get that working ?

Did you ever get it scrolling "Hotdog: $4.99 " ?

What exactly do you want this to do now ?

If all you want to do is add some spaces before "Hotdog:... " then go back to the version that worked and simply change:

static char jabberText[] = 
      "HotDog: "
      "$4.99 "
;

into:

static char jabberText[] = 
      "            HotDog: "
      "$4.99 "
;

Yours,
TonyWilk

P.S. thanks aarg - noted.

revengedeath:
did u find the error or fix it by chance?

Who are you asking, and what error do you mean?

Why not just clear the display and start scrolling in from the right side?

Ok then… the code you posted had this in it:

static char sp[] = 
      "           "
;

#include <string.h>

#define BUFFER_LEN 30
char bf[BUFFER_LEN];
strcpy( bf, sp);
strcat( bf, jabberText);

Those last 2 lines are calling functions to copy your spaces into your ‘bf’ array and then add on ‘jabberText’.
They have to be in your code somewhere, like inside loop().

Try putting them at the start of loop() like this:

void loop() {
  strcpy( bf, sp);
  strcat( bf, jabberText);

Now I suppose you want the output scrolling routines to use the contents of ‘bf’ and not just ‘jabberText’, so you’ll have to replace ‘jabberText’ with ‘bf’ in those ‘ggg’ routines.

Later I suppose you want to choose between just “jabberText” and “jabberText with spaces added” (or some other message), so you will have to put whatever you want to scroll into ‘bf’

like:

void loop() {
  if( just_show_jabberText_or_add_spaces  )   //some test to do one thing or the other
  {
    strcpy( bf, jabberText);   // just copy jabberText into bf
  }else
  {
    strcpy( bf, sp);           // copy spaces
    strcat( bf, jabberText);   // and then jabberText into bf
  }

Yours,
TonyWilk