Crestron simpl plus language ref 사용자 설명서

다운로드
페이지 374
Crestron SIMPL+
®
Software 
Language Reference Guide - DOC. 5797G
 SIMPL+
®
 
z 323
                        // corresponding value
   Print( “My name is %s.  My age is %d”, 33, “David” ); // 
error -
                        // both format specifiers contain 
corresponding
                        // values of different datatypes
   SetArray( strArr, 1 );     // ok
   SetArray( strArr, “abc” ); // ok
   SetArray( intArr, 0 );     // ok
   SetArray( “abc”, 1 );      // error – “abc” is not an array
   SetArray( 1, “abc” );      // error – 1 is not an array
}
Compiler Error 1505
function argument error:  Format string contains invalid 
format specifier
An invalid format specifier was used within a format string.
Format strings contain specifications that determine the output format for the 
arguments.  The format argument consists of ordinary characters, escape sequences, 
and (if arguments follow format) format specifications  Format Specifications always 
begin with a percent sign (%) and are read left to right. When the first format 
specification is encountered (if any), it converts the value of the first argument after 
format and outputs it accordingly. The second format specification causes the second 
argument to be converted and output, and so on.
The following are examples of this error:
FUNCTION MyFunc() 
{
   Print( “Hello World” );                                    // ok
   Print( “My name is %s.  My age is %d”, “David”, 33 );      /
/ ok
   Print( “My name is %xs”, “David” ); // error - %xs is an 
invalid
                                       //         format specifier
}