Maya API : format messages to the script editor


Can someone help me use the Maya API to format messages to the script editor?

			MString msg;
			std::cout << "Mesh: " << << "\n"; //prints to stdout / Maya ourpur window
			msg.format("Mesh: ",; // based on API examples.
			MGlobal::displayInfo(msg); // prints "//  //" in script editor

I can get stdout to the output window, I just want the info to be in the script editor
I want to format stuff like printf( "data result = %s", data)

You need format specifiers, don’t got maya in front of me at the moment but it would be something like this.

MString msg;
msg.format("Mesh: ^1s",;

you might need to wrap the part into a MString as well, i forget if it will do a implicit cast or not

1 Like

ah so it’s MEL format command. eewww.
MString.format will accept a c_string

yep its gross, and from the time where everyone just implemented there own string type for every framework