Hope this helps.
You can also add the default LogMessage() into the function to get an
output in the VS-Debug window and the script editor.
void LogMessageDebug( CString inString, bool end = true );
void LogMessageDebug( CString inString, bool end ) {
ostringstream ss;
ss << inString.GetAsciiString();
ss << "; ";
if( end )
ss << "\n";
OutputDebugString( ss.str().c_str() );
}
SICALLBACK XSILoadPlugin(PluginRegistrar& in_reg) {
CLongArray longArray;
CStringArray stringArray;
CFloatArray floatArray;
for( long t = 0; t < 10; ++t ) {
longArray.Add( t + 1 );
floatArray.Add(sqrtf( t ) );
stringArray.Add( L"Hello, this is my string test " + CString( 10 -
( t + 1 ) ) );
}
for( long t = 0; t < longArray.GetCount(); ++t ) {
LogMessageDebug( L"LONG: " + CString( longArray[ t ] ), false );
LogMessageDebug( L"float: " + CString( floatArray[ t ] ), false );
LogMessageDebug( L"string: " + CString( stringArray[ t ] ) );
}
return CStatus::OK;
}
The image shows the debug output.
2015-11-22 0:15 GMT+01:00 Matt Lind <[email protected]>:
> I don't think you can view CString directly in the debugger (or at least,
> not without jumping through a lot of hoops).
>
> I tended to convert CString to a temporary C++ string or C char string for
> that purpose, which wasn't often. To dump to the console/script log, be
> sure to convert the CString to text before calling LogMessage() (eg;
> Object.FullName.GetAsText() or CString.GetAsciiString() ).
>
> I would need to see an example of your CLongArray issue to comment on it
> as I've never run into that issue.
>
> Matt
>
>
>
>
>
>
> Date: Sat, 21 Nov 2015 19:39:12 +0300
> From: Andruha Prostrelov <[email protected]>
> Subject: VS2012 Debugg CString CValue
> To: [email protected]
>
>
> Hello list =)
> My name is Andrew and i am XSI enthusiast.
>
> Since i develop pluggins in C++ i often debugg values through
> Application().LogMessage function.
> But i can't reach this log messages when i am in debugg process.
> And without this LogMessage function i have a problem debugging CString
> variables
> and variables recived from CLongArray by index via VisualStudio2012.
>
> Is there a way to recive chars and numerical values from this objects in
> readable form during debugging session ?
>