Send dynamic tweet strings via the Twitter library

Hello everyone!

I use the Twitter library that supports OAuth Arduino Playground - Twitter Library and i want to post the values from a temperature sensor along with some additional text, in the same tweet.

As such, a tweet should contain a static text as well as the dynamic temperature value taken from the temp sensor.

So here is my question:

How can i concatenate a static text with a dynamic value in order to send the entire string via a single tweet ?

I test the following code taken from the Twitter library page:

/* Post a simple message to Twitter  */
#include <Ethernet.h>
#include <Twitter.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
byte gateway[] = { 10, 0, 0, 1 };
byte subnet[] = { 255, 255, 0, 0 };

Twitter twitter("YOUR-TOKEN");
char msg[] = "Hello, World! I'm Arduino!";

void setup()
{
  Ethernet.begin(mac, ip, gateway, subnet);
  Serial.begin(9600);

  delay(1000);

  Serial.println("connecting ...");
  if (twitter.post(msg)) {
    int status = twitter.wait();
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }
}

void loop()
{
}

In the example code above, the string array variable contains a static string

char msg[] = "Hello, World! I'm Arduino!";

The "post" function of the twitter library twitter.post(msg) expects a const char *message variable.

What do i need to do to concatenate a static text and a dynamic value ?

Any help to the right direction is much appreciated!

John

Something like this:

char buffer[80];
sprintf(buffer, "Current temp: %d", tempC);

twitter.post(buffer);

Thank you PaulS!!

It works OK now!