version 2003
PA_GetStringParameter (params; index; string)
| Parameter | Type | Description | |
| params | PA_PluginParameters | Parameters received in PluginMain | |
| index | short | Index of the parameter in params | |
| string | char * | Value (C/P string) of the index parameter |
Description
The routine PA_GetStringParameter fills string with the value (of type string) of the index parameter in params.
Depending on previous calls to PA_UsePStrings or PA_UseCStrings, string will be a C or a Pascal string.
See Create a new plugin for a description of parameter accessors.
NOTE:
The first parameter starts at index 1.
Example
Compare 2 strings.
void PluginMain( long selector, PA_PluginParameters params )
{
switch ( selector )
{
. . .kInitPlugin, kDeinitPlugin ...
case kMyRoutine :
MyCompare(params);
break;
}
}
// Declared as expecting a string, a string and returning a long (0-1)
void MyCompare (PA_PluginParameters params)
{
char first[256], second[256]; //C_STRING, max 255
char result = 0;
// get the parameters
PA_GetStringParameter(params, 1, first);
PA_GetStringParameter(params, 2, second);
// Compare them (we are using C strings in this sample)
result = (char) strcmp(first, second) ? 0 : 1; strcmp returns 0 if the strings are equal
PA_ReturnLong(params, result);
}
See Also
About strings and characters, Create a new plugin.
Error Handling
PA_GetLastError keeps the last error that occurred before calling the routine.