On 29/12/2014 at 17:34, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 13
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
I've been trying to understand how to pass command line arguments to C4D in C++. But nothing I'm trying is working.
Every time I try to pass a value to args->argv _C4D crashes when it starts.
And this code that Maxon put there does not print anything no matter how I edit the code.
case C4DPL_COMMANDLINEARGS:
{
C4DPL_CommandLineArgs *args = (C4DPL_CommandLineArgs* )data;
for (LONG i=0;i<args->argc;i++)
{
if (!args->argv[i]) continue;
if (!strcmp(args->argv[i],"--help") || !strcmp(args->argv[i],"-help"))
{
// do not clear the entry so that other plugins can make their output!!!
GePrint("\x01-SDK is here :-)");
}
else if (!strcmp(args->argv[i],"-SDK"))
{
args->argv[i] = NULL;
GePrint("\x01-SDK executed:-)");
}
else if (!strcmp(args->argv[i],"-plugincrash"))
{
args->argv[i] = NULL;
*((LONG* )0) = 1234;
}
}
}
break;
I'm reading how to use commandline arguments in raw C++ code. But they never seem to work in C4D. It always crashes.
Can someone please shed some light how how these things work. And tell me how to pass values into them in C4D so that they print to the console when C4D launches?
Thanks,
-ScottA