The pointer returned from c_str becomes invalid as soon as the owning string is
destroyed. You can write your label into the passed char* and then return that
instead.
-Nathan
From: Johannes Saam
Sent: Tuesday, January 13, 2015 2:00 PM
To: Nuke plug-in development discussion
Subject: [Nuke-dev] input_label and std::strings
Hey folks,
quick one....
i seam to have trouble in my input_label using std::strings
i have tried this now in different plugins so its not a crazy compile related
problem... nothing worked...
the classic input label looks something like this
const char * input_label( int n, char * ) const
{
if ( n == 0 )
return "some label";
if ( n == 1 )
return "some other label";
}
so far so good that works of course.
in my case i have std::strings with the label and the simplest test like
{
str::string foo = "test";
return foo.c_str();
}
results in a blank label.... sometimes i get a label but with stupid
characters...
why is that? Does not make much sense to me...
i am creating lots of custom inputs based on a Table_knob ( whch internally
uses std::string ) so i have not a lot of options.
Windows 7 nuke9
can anyone enlighten me?
jo
--------------------------------------------------------------------------------
_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev
_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev