Issue with including variable into string for use with OSC library.

Hi there - im pretty new to Arduino and programming but slowly getting to grips. Come across a issue and after lots of research i just cannot work away round it. I am trying to send OSC messages with a variable in the address. The variable is a random number which is generated. The messsage I am trying to send is "/Test/x" where x is the random number. Using some examples from the OSC library from CNMAT i have the following -
#include <OSCMessage.h>

#include <OSCMessage.h>

/*
    Make an OSC message and send it over UDP
    
    Adrian Freed
 */
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>    
#include <OSCMessage.h>

EthernetUDP Udp;

//the Arduino's IP
IPAddress ip(192, 168, 0, 2);
//destination IP
IPAddress outIp(192, 168, 0, 1);
const unsigned int outPort = 9999;

 byte mac[] = {  
  0x90, 0xA2, 0xDA, 0x0D, 0xC0, 0x85 }; // you can find this written on the board of some Arduino Ethernets or shields
void setup() {
  Ethernet.begin(mac,ip);
    Udp.begin(8888);
  Serial.begin(9600);
}


void loop(){
  //the message wants an OSC address as first argument
  
  int Address(random(1 ,51));
  
  int i = Address;
  
  OSCMessage msg =("/Test/"+i);
  msg.add(1);
    
  Serial.println(value);
  
  Udp.beginPacket(outIp, outPort);
  msg.send(Udp); // send the bytes to the SLIP stream
  Udp.endPacket(); // mark the end of the OSC Packet
  msg.empty(); // free space occupied by message

  delay(50);
}

I have tried several ways of concatenating the number into this string but to no avail - anyone offer any assistance out there?

Thanks

  int Address(random(1 ,51));

This defines a function that returns and int, and takes nonsense as input. It does not declare a variable.

  int i = Address;

This assigns the address of the function to i.

  OSCMessage msg =("/Test/"+i);

What are you expecting to get when you ADD a literal string and the address of a non-implemented function?

int i = random(1, 51);
char buff[16];
sprintf(buff, "/Test/%d", i);
OSCMessage msg(buff);

is probably closer to what you want.

Paul,

Thanks I appreciate the feedback. It was wht i was struggling with and new that was the issue. ill try it out later. Again thanks for taking the time to come back to me,

Regards.