View Full Version : Maya C++ API and "\n"
chalbers 07-06-2009, 02:00 AM Hello,
I'm having a strange behaviour printing out to the Maya "Output Window" through my C++ plugin using Windows.
When I use the line:
cout << "Test" << endl;
It prints out correctly.
When I use line:
cout << "Test\n";
It doesn't print anything UNTIL I close my plugin in the Plug-in Manager ... then it DOES print.
Any ideas ?
Thanks,
Frank
|
|
chalbers
07-06-2009, 02:42 AM
Well ... I found a fix, I still don't know why this works but.
Et the end of every command in my plug-in I just add:
cout << endl;
And all my previous printf's or cout's using \n suddenly do work.
Very strange !
Frank
ticket01
07-06-2009, 05:55 AM
endl makes sure that the stream buffer gets flushed whilst "\n" does not.
chalbers
07-06-2009, 04:18 PM
endl makes sure that the stream buffer gets flushed whilst "\n" does not.
It's a pain to remember to use endl though.
Keilun
07-06-2009, 05:49 PM
The alternative is to remember to flush the stream manually.
Or, use the script editor output, MGlobal::displayInfo/Error/Warning
Robert Bateman
07-08-2009, 05:16 PM
Or, use the script editor output, MGlobal::displayInfo/Error/Warning
I vote for this method. You can clear the output from the script editor, unlike the output window. Be warned that if you start dumping loads of stuff into (either) window, performance will be severely impacted.
chalbers
07-08-2009, 05:48 PM
I vote for this method. You can clear the output from the script editor, unlike the output window. Be warned that if you start dumping loads of stuff into (either) window, performance will be severely impacted.
That's why I didn't vote for the script editor. I'm printing loads ! :)
CGTalk Moderation
07-08-2009, 05:48 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.