The UClient object has a send method which works like printf:
client->send("motor on;");
for (float val=0; val<=1; val+=0.05)
client->send("neck'n = %f;wait (%d);", val, 50);
You can also use your client object as a stream if you prefer a more C++ like approach:
client << "headPan = " << 12 << ";";
There is also a very convenient way of sending blocks of URBI code from a C++ program, using the URBI((...)) macro:
URBI((
headPan = 12,
echo "hello" | speaker.play("test.wav") & leds = 1
));
The text between the double parenthesis will be sent verbatim to the first client created by your program, by default. This can be set with a call to urbi::connect(...). The first described approach, using the send method, is more appropriate in general and the URBI macro should only be used to send initialization scripts in a convenient way at the beginning of your program, or for fast prototyping.
Remember that you can always give your robot a fresh start (a virtual reboot) by sending the reset command. This will avoid the multi definition of functions or restarting several occurrences of an at command each time you rerun your liburbi-based client. So many liburbi main programs will start with client->send("reset;");