MAX SDK: String Concatenation with other variable types
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've been having a lot of trouble working with the string types in the max SDK:
as an example lets say in a loop i want to output a sequence of integers concatenated to the end of a string
int i = 0;
while (threadRunning){
STD::string s = "Hello " + STD::to_string(i); //STD::string concat
s += "\n"; //line feed;
//convert string to character array, then store it as a CStr
CStr cs(s.c_str());
//ouput to listener by finally converting it to a WStr
the_listener->edit_stream->wputs(cs.ToMSTR());
the_listener->edit_stream->flush();
Sleep(1000);
i++;
}I was able to make it work with that code but it feels really hacky. There must be a better way of doing this so i can avoid the STD:string object all together.
I spent a lot of time in the docs and could not find a simple say of concatenating an integer on to the end of the MaxString string types.
Please excuse me if this seems like a really noobish thing. i've only started really digging into the MAX sdk the last week or so and am having a hell of a time dealing with strings. I come from a background of mostly managed code like C# and these sorts of things have me totaly baffled.