Hi, I possess very little knowledge of C++ but I need to build a WIN32 PD external based on a third pardy API.
My main problem is how do I output a String?
The external is for integration with a sensor system called Ubisense. In the following code snippet, I need to find the name of an Object (the name of a sensor) and output it throught a Pure Data outlet. Would it be easier to use outlet_symbol()? If so how?
/////////////////////////////////////////////////////////////////////
Map<Object, Location> locations; //Create map
Map<Object, Location>::const_iterator Map_Iter; //Create map iterator
PdLocationClient->get_all_locations(locations); //Fill the Map with the objects and their locations
String name; //Not sure this is a proper aproach
for (Map_Iter = locations.begin ( ); Map_Iter != locations.end(); ++Map_Iter) //Unfold the Map
{
outlet_float(x->z_out, Map_Iter->second.pos_.z_ ); //output z location
outlet_float(x->y_out, Map_Iter->second.pos_.y_ ); //output y location
outlet_float(x->x_out, Map_Iter->second.pos_.x_ ); //output x location
PdNameClient->get_object_name(Map_Iter->first, name); //Get the human readable Object name //bool get_object_name (const Object &object, String &name)
//PROBLEMS START HERE
array<char> namearray = name->ToCharArray() ; //???Convert the String to a char array????
outlet_anything(x->name_out, &s_symbol, name->Length , *namearray); //???Output the char array??? void outlet_anything(t_outlet *x, t_symbol *s, int argc, t_atom *argv);
}
}
/////////////////////////////////////////////////////////////////////
Any help appreciated.
Tom