Difference between pages "General/Strings" and "Building License Installation - 4.0"

From ROBOTC API Guide
< General(Difference between pages)
Jump to: navigation, search
(strcat)
 
(Install ROBOTC)
 
Line 1: Line 1:
{| style="font-family:Verdana, Genega, sans-sarif; font-size:80%;color:gray;" width="100%" cellpadding="0%" cellspacing="0" border="0"
+
{|
 
|-
 
|-
|  
+
|There is a special type of ROBOTC license called a Building License . These licenses do not require an online activation but rather have a unique building license file that must be installed with the software in order for ROBOTC to work properly. The building license file is stored on the ROBOTC Customer Service server and can be accessed by the end user at any time. To do so, you will need to:
''[[Main_Page|Main]] >> [[VEX2_Main|CORTEX]] >> [[VEX2: Functions| Functions and Variables]] >> [[VEX2:_Functions_-_Strings|Strings]] ''
+
 
|-
 
|-
|}
+
|
 
+
* Download the latest version of ROBOTC
 
+
* Install ROBOTC
{| class="wikiText"
+
* Download the building license file from the ROBOTC Customer Service page
 +
* Install and activate the building license file
 
|-
 
|-
|''For information about displaying on the VEX LCD, please see the article: [[VEX2:_Functions_-_Display|Display]].''
+
|<br />
 
+
 
+
When displaying floats, for example, you can tell ROBOTC how many decimals places to display.  This is standard across all 'C' - like programing languages.  For example, if your float is <span class="keywordB">PI</span> '''(3.14159265)''', but you only want to dispay '''"3.14"''', your string should contain, <span class="codePunc">"%</span><span class="codeStringsNums">1.2f</span><span class="codePunc">"</span>.
+
+
The number '''''before''''' the decimal is how many digits '''''before''''' the decimal you wish to display, while the number '''''after''''' the decimal is how many digits '''''after''''' the decimal you wish to display.  So <span class="codePunc">"%</span><span class="codeStringsNums">1.2f</span><span class="codePunc">"</span> tells us to display one digit before the decimal and two digits after the decimal, with '''"3.14"''' as the final result.
+
 
|-
 
|-
 
|}
 
|}
  
 
+
== Download the latest version of ROBOTC ==
 
{|
 
{|
 +
|Before we start programming in ROBOTC, we need to first download and install the client. This can be done by navigating to ROBOTC's website ( http://www.robotc.net) and selecting the 'Downloads' tab.
 
|-
 
|-
|style="vertical-align:top"| __TOC__
+
|<br />
|style="vertical-align:top"|
+
{| width="100" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border-width: 1px; border-style: solid; border-color: #000"
+
!colspan="2" class="wikiHeader"|Color Key
+
|-
+
|class="wikiText" width="75%" style="border-style: solid; border-width: 1px 0px 0px 0px"|Function:
+
|width="25%" style="border-style: solid; border-width: 1px 0px 0px 0px;" class="colorKeyFunc"|
+
|-
+
|class="wikiText" width="75%" style="border-style: solid; border-width: 0px 0px 0px 0px"|Variable:
+
|width="25%" style="border-style: solid; border-width: 0px 0px 0px 0px;" class="colorKeyVar"|
+
|}
+
 
|-
 
|-
|}
+
|'''1)''' From the ROBOTC website, select the individual robotics platform you wish to program on. If you want to use multiple platforms or accidentally download the wrong version, you can manually activate and choose another platform thorugh the ROBOTC program. When you get to the correct platform page, click on the 'Download ROBOTC for X version x.xx' to start the download process:  
 
+
 
+
== strcat ==
+
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
|-
 
|-
| class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">strcat</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">void </span><span class="bigCodeBasic">&pToBuffer</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const void </span><span class="bigCodeBasic">&pFromBuffer</span><span class="bigCodePunc">)</span>
+
|<br />
 
|-
 
|-
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_void|void]]) Function concatenates <span class="codeBasic">pFromBuffer</span> onto end of <span class="codeBasic">pToBuffer</span>. The variables are arrays of bytes terminated with zero character. It is user responsibility to ensure that the 'To' array is large enough to hold the result. ROBOTC is not able to do any range checking! Identical to the function found in conventional C 'string.h' library.
+
|[[File:Install_Download_Firefox.png]]
 
|-
 
|-
|
+
|<br />
  {| class="parameterTable" cellpadding="5%" width="100%"
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
+
  ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
+
  |-
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|''pToBuffer''
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|Characters from 'pFromBuffer' are concatenated ''to the end'' of this.
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types#dataType_void|void]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|''pFromBuffer''
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|Concatenates characters ''from'' here.
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_void|void]]
+
  |-
+
  |}
+
 
|-
 
|-
|
+
|[[File:Install_Download_IE.png]]
  {|
+
|-
  |-
+
|<br />
  |<syntaxhighlight lang="ROBOTC">
+
string str1 = "ROBOT";            // string 'str1' is "ROBOT"
+
string str2 = "C";                // string 'str2' is "C"
+
 
+
strcat(str1, str2);              // concatinate string 'str2' onto string 'str1'
+
 
+
displayNextLCDString(1,0, str1);  // display the new 'str' ("ROBOTC")
+
</syntaxhighlight>
+
  |-
+
  |}
+
 
|-
 
|-
 +
|'''2)''' At this point click the 'Save' button to start downloading ROBOTC. You may get a warning pop-up from either Windows, your antivirus program, or both. This is to warn you that some programs downloaded from the internet can be malicious and to use care before running them; click allow to start the download.
 +
|-
 +
|<br />
 
|}
 
|}
<br />
 
  
== strcmp ==
+
== Install ROBOTC ==
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
{|
 +
|'''1)''' Once the program is done downloading, navigate to the Downloads folder on your computer and start the ROBOTC installer. You may have to right click on the installer and select the "Run as Administrator" depending on individual computer restrictions; ROBOTC must be installed with administrator privileges.
 
|-
 
|-
| class="functionType"| <span class="bigKeywordBI">short </span><span class="bigKeywordB">strcmp</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">void </span><span class="bigCodeBasic">&pString1</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const void </span><span class="bigCodeBasic">&pString2</span><span class="bigCodePunc">)</span>
+
|<br />
 
|-
 
|-
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_short|short]]) Function compares <span class="codeBasic">pString1</span> with <span class="codeBasic">pString2</span>. Returns negative value if less than, 0 if equal and positive value if greater than. The variables are arrays of bytes terminated with a zero char. Identical to the function found in conventional C 'string.h' library.
+
|[[File:Install_Normal.png]]
 
|-
 
|-
|
+
|<br />
  {| class="parameterTable" cellpadding="5%" width="100%"
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
+
  ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
+
  |-
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|''pString1''
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|A string to compare with 'pString2'.
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types#dataType_void|void]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|''pString2''
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|A string to compare with 'pString1'.
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_void|void]]
+
  |-
+
  |}
+
 
|-
 
|-
|
+
|'''2)''' Before you can proceed, you must read over and accept the End User License Agreement. If you agree to the End User Agreement, check the "I accept" and then the "Next" button to continue the installation.
  {|
+
  |-
+
  |<syntaxhighlight lang="ROBOTC">
+
string str1 = "Fett";                      // string 'str1' is "Fett"
+
string str2 = "Fett";                      // string 'str2' is "Fett"
+
 
+
if(strcmp(str1, str2) < 0)                            // if 'str1' < 'str2':
+
{
+
  nxtDisplayCenteredTextLine(3, "str1 is < than str2");  // display that 'str1' is < 'str2'
+
}
+
else if(strcmp(str1, str2) > 0)                        // if 'str1' > 'str2':
+
{
+
  nxtDisplayCenteredTextLine(3, "str1 is > than str2");  // display that 'str1' is > 'str2'
+
}
+
else                                                  // if 'str1' == 'str2':
+
{
+
  nxtDisplayCenteredTextLine(3, "str1 = str2");          // display that 'str1' is = 'str2'
+
}
+
</syntaxhighlight>
+
  |-
+
  |}
+
 
|-
 
|-
|}
+
|<br />
<br />
+
 
+
== strcpy ==
+
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
|-
 
|-
| class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">strcpy</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">void </span><span class="bigCodeBasic">&pToBuffer</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const void </span><span class="bigCodeBasic">&pFromBuffer</span><span class="bigCodePunc">)</span>
+
|[[File:Install_End_User.png]]
 
|-
 
|-
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_void|void]]) Function copies <span class="codeBasic">pFromBuffer</span> to <span class="codeBasic">pToBuffer</span>. The variables are arrays of bytes terminated with a zero character. It is user responsibility to ensure that the 'To' array is large enough to hold the result. ROBOTC is not able to do any range checking! Identical to the function found in conventional C 'string.h' library.
+
|<br />
 
|-
 
|-
|
+
|'''3)''' Next, select where you would like ROBOTC to install to. The default location is C:/Program Files (x86)/Robomatter Inc/ROBOTC Development Environment.
  {| class="parameterTable" cellpadding="5%" width="100%"
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
+
  ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
+
  |-
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|''pToBuffer''  
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|Copies 'pFromBuffer' to this.
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types#dataType_void|void]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|''pFromBuffer''
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|Copies this to 'pToBuffer'.
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_void|void]]
+
  |-
+
  |}
+
 
|-
 
|-
|
+
|<br />
  {|
+
  |-
+
  |<syntaxhighlight lang="ROBOTC">
+
string str1 = "";                          // string 'str1' is "" (empty)
+
string str2 = "DNA";                        // string 'str2' is "DNA"
+
 
+
strcpy(str1, str2);                        // copy string 'str2' onto string 'str1'
+
 
+
nxtDisplayCenteredTextLine(3, "%s", str1);  // display the new 'str' ("DNA")
+
</syntaxhighlight>
+
  |-
+
  |}
+
 
|-
 
|-
|}
+
|[[File:Install_Select_Directory.png]]
<br />
+
 
+
== StringDelete ==
+
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
|-
 
|-
| class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">StringDelete</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">string </span><span class="bigCodeBasic">&sDest</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const int </span><span class="bigCodeBasic">nIndex</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const int </span><span class="bigCodeBasic">nSize</span><span class="bigCodePunc">)</span>
+
|<br />
 
|-
 
|-
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_void|void]]) Deletes a substring from a string.
+
|'''4)''' The installer will ask you to confirm your settings. If everything looks correct, click "Install" to being the installation process. The installer will then begin copying files from the installer to your computer. Please wait until this is complete.<br />
 
|-
 
|-
|
+
|<br />
  {| class="parameterTable" cellpadding="5%" width="100%"
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
+
  ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
+
  |-
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|''sDest''
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|The string to delete from.
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types#dataType_string|string]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|''nIndex''
+
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|The index of the first character to delete (1st character = index 0).
+
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|[[Data_Types#dataType_int|int]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|''nSize''
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|The number of characters to delete, starting 'nIndex'.
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_int|int]]
+
  |-
+
  |}
+
 
|-
 
|-
|
+
|[[File:Install_Install_Progress.png]]
  {|
+
  |-
+
  |<syntaxhighlight lang="ROBOTC">
+
string str = "mesGARBAGEsage";              // String 'str' is "mesGARBAGEsage".
+
 
+
StringDelete(str, 3, 7);                    // Delete from index 3 to the 7th char after that.
+
                                            /* Confusing because 3 = index 3, not char 3.  Since indexing */
+
                                            /* starts with 0, index 3 is the 4th character.              */
+
+
nxtDisplayCenteredTextLine(3, "%s", str1);  // Display the new 'str' ("message").
+
</syntaxhighlight>
+
  |-
+
  |}
+
 
|-
 
|-
|}
+
|<br />
<br />
+
 
+
== StringFind ==
+
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
|-
 
|-
| class="functionType"| <span class="bigKeywordBI">int </span><span class="bigKeywordB">StringFind</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">const string </span><span class="bigCodeBasic">&sSrce</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const string </span><span class="bigCodeBasic">&sSearch</span><span class="bigCodePunc">)</span>
+
|'''5)''' The installer will inform you when the installation is complete. Click the "Finish" button to complete your install.<br />
 
|-
 
|-
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_int|int]]) Finds the position in a string of the selected substring.
+
|<br />
 
|-
 
|-
|
+
|[[File:Install_Complete.png]]
  {| class="parameterTable" cellpadding="5%" width="100%"
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
+
  ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
+
  |-
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|''sSrce''
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|String to search through.
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types#dataType_string|string]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sSearch''
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|Substring to look for.
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_string|string]]
+
  |-
+
  |}
+
 
|-
 
|-
|
+
|<br />
  {|
+
  |-
+
  |<syntaxhighlight lang="ROBOTC">
+
string str = "mesHIDDENsage";                        // String 'str' is "mesGARBAGEsage".
+
int index_of_substr;                                  // Int, 'index_of_substr' to be used by "StringFind()".
+
 
+
index_of_substr = StringFind(str_msg, "HIDDEN");      /* Search for the substring, "HIDDEN" */
+
                                                      /* withing the string, 'str'.        */
+
+
nxtDisplayCenteredTextLine(3, "%d", index_of_substr); // Display the new index of the substring, "HIDDEN".
+
</syntaxhighlight>
+
  |-
+
  |}
+
 
|-
 
|-
 
|}
 
|}
<br />
 
  
== StringFormat ==
+
== Download the ROBOTC Building License File ==
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
{|
 +
|'''1)''' Navigate to the [https://secure.softwarekey.com/solo/customers/Default.aspx ROBOTC Customer Service page] and log in using your Customer ID and Password (this information will be sent to you in a confirmation email after purchasing a ROBOTC Building License).
 
|-
 
|-
| class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">StringFormat</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">string </span><span class="bigCodeBasic">&sDest</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const string </span><span class="bigCodeBasic">sFormatString</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">...</span><span class="bigCodePunc">)</span>
+
|<br />
 
|-
 
|-
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_void|void]]) Formats a string using the specified format-string.
+
|[[File:Building License Login.png]]<br />
 
|-
 
|-
|
+
|<br />
  {| class="parameterTable" cellpadding="5%" width="100%"
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
+
  ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
+
  |-
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|''sDest''
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|The string to format.
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types#dataType_string|string]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sFormatString''
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|The format-string to apply to 'sDest'.
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_string|string]]
+
  |-
+
  |}
+
 
|-
 
|-
|
+
|'''2)''' Select the "Licenses and Activations" icon to view all of the licenses tied to that Customer ID.
  {|
+
  |-
+
  |<syntaxhighlight lang="ROBOTC">
+
string str = "";                          // Create String, 'str' and initialize it as 'empty'.
+
float num = 3.14159;                      // Create float, 'num' and initialize it as first 6 digits of pi.
+
 
+
StringFormat(str, "%1.2f", num);          /* Format num into a float to 2 decimal places, then send it to
+
                                              the string, 'str'.                                          */
+
nxtDisplayCenteredTextLine(3, "%s", str);  // Display the new string, str. ("3.14").
+
</syntaxhighlight>
+
  |-
+
  |}
+
 
|-
 
|-
|}
+
|<br />
<br />
+
 
+
== StringFromChars ==
+
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
|-
 
|-
| class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">StringFromChars</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">string </span><span class="bigCodeBasic">&sToString</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const char </span><span class="bigCodeBasic">&FromChars</span><span class="bigCodePunc">)</span>
+
|[[File:Building License Select.png]]<br />
 
|-
 
|-
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_void|void]]) Converts an array of bytes to a string value.  You MUST end your char array with a char value of zero!
+
|<br />
 
|-
 
|-
|
+
|'''3)''' Select the correct Building License File from the list of available licenses (in this example, a ROBOTC for VEX Robotics 4.0 Building License file).
  {| class="parameterTable" cellpadding="5%" width="100%"
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
+
  ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
+
  |-
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|''sToString''  
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|The string to copy characters ''to''.
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types#dataType_string|string]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|''FromChars''
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|The character array to copy characters ''from''.
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_char|char]]
+
  |-
+
  |}
+
 
|-
 
|-
|
+
|<br />
  {|
+
  |-
+
  |<syntaxhighlight lang="ROBOTC">
+
char test[10];    // create an array of chars of size 10 named 'test'
+
string str = "";  // create an empty string named 'str'
+
 
+
test[0] = 'R';
+
test[1] = 'O';
+
test[2] = 'B';
+
test[3] = 'O';
+
test[4] = 'T';
+
test[5] = 'C';
+
test[6] = (char)0;  // index 6 is character value zero
+
test[7] = 'X';      /* these characters              */
+
test[8] = 'X';      /* never get copied              */
+
test[9] = 'X';      /* since they are after the zero  */
+
 
+
StringFromChars(str, test);                    // copy chars from 'test' to 'str'
+
 
+
nxtDisplayCenteredTextLine(3, "str: %s", str);  // display 'str' to line 3 of NXT LCD
+
}
+
</syntaxhighlight>
+
  |-
+
  |}
+
 
|-
 
|-
|}
+
|[[File:Building License Select2.png]]<br />
<br />
+
 
+
== strncat ==
+
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
|-
 
|-
| class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">strncat</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">void </span><span class="bigCodeBasic">&pToBuffer</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const void </span><span class="bigCodeBasic">&pFromBuffer</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const short </span><span class="bigCodeBasic">nMaxBufferSize</span><span class="bigCodePunc">)</span>
+
|<br />
 
|-
 
|-
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_void|void]]) Function concatenates <span class="codeBasic">pFromBuffer</span> onto end of <span class="codeBasic">pToBuffer</span>. The variables are arrays of bytes terminated with a zero character. nMaxBufferSize is the maximum size of ‘pFromBuffer’ and is usually created with a <span class="keywordBI">sizeof</span><span class="codePunc">(</span><span class="codeBasic">..</span><span class="codePunc">)</span> function call. Identical to the function found in conventional C 'string.h' library file.
+
|'''4)''' Click the 'Download License File' button to download the license file to your computer.
 
|-
 
|-
|
+
|<br />
  {| class="parameterTable" cellpadding="5%" width="100%"
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
+
  ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
+
  |-
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|''pToBuffer''
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|'pFromBuffer' gets concatenated onto the end of this.
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types#dataType_void|void]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|''pFromBuffer''
+
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|This gets concatenated onto the end of 'pToBuffer'.
+
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|[[Data_Types#dataType_void|void]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|''nMaxBufferSize''
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|How many characters to concatenate.
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_short|short]]
+
  |-
+
  |}
+
 
|-
 
|-
|
+
|[[File:Building License Download.png]]<br />
  {|
+
  |-
+
  |<syntaxhighlight lang="ROBOTC">
+
string str1 = "ROBOT";                      // String 'str1' is "ROBOT".
+
string str2 = "C!";                        // String 'str2' is "C!".
+
 
+
int copy_length = 1;                        // Int 'copy_length' is set to 1.
+
 
+
strncat(str1, str2, copy_length);          /* Concatinate 'copy_length' amount of characters
+
                                              from string 'str2' onto string 'str1'.        */
+
 
+
nxtDisplayCenteredTextLine(3, "%s", str1);  // Display the new 'str' ("ROBOTC"), (the "!" is not copied).
+
</syntaxhighlight>
+
  |-
+
  |}
+
 
|-
 
|-
|}
+
|<br />
<br />
+
 
+
== strncmp ==
+
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0"
+
 
|-
 
|-
| class="functionType"| <span class="bigKeywordBI">short </span><span class="bigKeywordB">strncmp</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">void </span><span class="bigCodeBasic">&pString1</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const void </span><span class="bigCodeBasic">&pString2</span><span class="bigCodePunc">, </span><span class="bigKeywordBI">const short </span><span class="bigCodeBasic">nMaxBufferSize</span><span class="bigCodePunc">)</span>
+
|To activate ROBOTC with a building license, download and run the installer as normal. Once the program is installed, copy the building license file into the ROBOTC directory (typically C:/Program Files (x86)/Robomatter Inc/ROBOTC Developement Environment).
 
|-
 
|-
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|([[Data_Types#dataType_short|short]]) Function compares <span class="codeBasic">pString1</span> with <span class="codeBasic">pString2</span>. Returns negative value if less than, 0 if equal and positive value if greater than. The variables are arrays of bytes terminated with a zero char. <span class="codeBasic">nMaxBufferSize</span> is the maximum number of bytes to compare and is usually created with a <span class="keywordBI">sizeof</span><span class="codePunc">(</span><span class="codeBasic">..</span><span class="codePunc">)</span> function call. Identical to the function found in conventional C 'string.h'
+
|<br />
 
|-
 
|-
|
+
|[[File:Building_License_Location.png]]
  {| class="parameterTable" cellpadding="5%" width="100%"
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Parameter
+
  ! width="60%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Explanation
+
  ! width="20%" style="border-style: solid; border-width: 0px 0px 1px 0px"|Data Type
+
  |-
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|''pString1''
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|A string to compare with 'pString2'.
+
  | style="border-style: solid; border-width: 1px 0px 1px 0px"|[[Data_Types#dataType_void|void]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|''pString2''
+
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|A string to compare with 'pString1'.
+
  | style="border-style: solid; border-width: 0px 0px 1px 0px"|[[Data_Types#dataType_void|void]]
+
  |-
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|''nMaxBufferSize''
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|How many characters to compare, starting from index 0.
+
  | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_short|short]]
+
  |-
+
  |}
+
 
|-
 
|-
|
+
|One of the advantages of building licenses is that they help make automated installs easy. To roll out ROBOTC to multiple computers using a building license, make sure the base image has ROBOTC installed and the building license files in the correct directory. As long as those two conditions are met, ROBOTC should be active on each computer the image is rolled out to with no futher action required.  
  {|
+
|-
  |-
+
|<br />
  |<syntaxhighlight lang="ROBOTC">
+
|-
string str1 = "Fett";                      // String 'str1' is "Fett".
+
|There is, however, an exception. If ROBOTC is being run from a centralized network, each computer that needs to access ROBOTC must also install a Network Dependencies package (available from the ROBOTC downloads page). The building license file must also be properly installed on the network in order for networked computers to access ROBOTC.
string str2 = "Fetts";                      // String 'str2' is "Fetts".
+
 
+
int cmp_chars = 4;                          /* Int 'cmp_chars' is the amount of chars
+
                                              to compare in "strncmp()". Here we will
+
                                              compare the first 4 chars of each string. */
+
 
+
if(strncmp(str1, str2, cmp_chars) < 0)                  // If 'str1' < 'str2' up to 4 chars:
+
{
+
  nxtDisplayCenteredTextLine(3, "str1 is < than str2");    // Display that 'str1' is < 'str2' up to 4 chars.
+
}
+
else if(strncmp(str1, str2, cmp_chars) > 0)              // If 'str1' > 'str2' up to 4 chars:
+
{
+
  nxtDisplayCenteredTextLine(3, "str1 is > than str2");    // Display that 'str1' is > 'str2' up to 4 chars.
+
}
+
else                                                    // If 'str1' == 'str2' up to 4 chars:
+
{
+
  nxtDisplayCenteredTextLine(3, "str1 = str2");            // Display that 'str1' is = 'str2' up to 4 chars.
+
}
+
</syntaxhighlight>
+
  |-
+
  |}
+
 
|-
 
|-
 
|}
 
|}
<br />
 

Revision as of 15:45, 14 May 2014

There is a special type of ROBOTC license called a Building License . These licenses do not require an online activation but rather have a unique building license file that must be installed with the software in order for ROBOTC to work properly. The building license file is stored on the ROBOTC Customer Service server and can be accessed by the end user at any time. To do so, you will need to:
  • Download the latest version of ROBOTC
  • Install ROBOTC
  • Download the building license file from the ROBOTC Customer Service page
  • Install and activate the building license file

Download the latest version of ROBOTC

Before we start programming in ROBOTC, we need to first download and install the client. This can be done by navigating to ROBOTC's website ( http://www.robotc.net) and selecting the 'Downloads' tab.

1) From the ROBOTC website, select the individual robotics platform you wish to program on. If you want to use multiple platforms or accidentally download the wrong version, you can manually activate and choose another platform thorugh the ROBOTC program. When you get to the correct platform page, click on the 'Download ROBOTC for X version x.xx' to start the download process:

Install Download Firefox.png

Install Download IE.png

2) At this point click the 'Save' button to start downloading ROBOTC. You may get a warning pop-up from either Windows, your antivirus program, or both. This is to warn you that some programs downloaded from the internet can be malicious and to use care before running them; click allow to start the download.

Install ROBOTC

1) Once the program is done downloading, navigate to the Downloads folder on your computer and start the ROBOTC installer. You may have to right click on the installer and select the "Run as Administrator" depending on individual computer restrictions; ROBOTC must be installed with administrator privileges.

Install Normal.png

2) Before you can proceed, you must read over and accept the End User License Agreement. If you agree to the End User Agreement, check the "I accept" and then the "Next" button to continue the installation.

Install End User.png

3) Next, select where you would like ROBOTC to install to. The default location is C:/Program Files (x86)/Robomatter Inc/ROBOTC Development Environment.

Install Select Directory.png

4) The installer will ask you to confirm your settings. If everything looks correct, click "Install" to being the installation process. The installer will then begin copying files from the installer to your computer. Please wait until this is complete.

Install Install Progress.png

5) The installer will inform you when the installation is complete. Click the "Finish" button to complete your install.

Install Complete.png

Download the ROBOTC Building License File

1) Navigate to the ROBOTC Customer Service page and log in using your Customer ID and Password (this information will be sent to you in a confirmation email after purchasing a ROBOTC Building License).

Building License Login.png

2) Select the "Licenses and Activations" icon to view all of the licenses tied to that Customer ID.

Building License Select.png

3) Select the correct Building License File from the list of available licenses (in this example, a ROBOTC for VEX Robotics 4.0 Building License file).

Building License Select2.png

4) Click the 'Download License File' button to download the license file to your computer.

Building License Download.png

To activate ROBOTC with a building license, download and run the installer as normal. Once the program is installed, copy the building license file into the ROBOTC directory (typically C:/Program Files (x86)/Robomatter Inc/ROBOTC Developement Environment).

Building License Location.png
One of the advantages of building licenses is that they help make automated installs easy. To roll out ROBOTC to multiple computers using a building license, make sure the base image has ROBOTC installed and the building license files in the correct directory. As long as those two conditions are met, ROBOTC should be active on each computer the image is rolled out to with no futher action required.

There is, however, an exception. If ROBOTC is being run from a centralized network, each computer that needs to access ROBOTC must also install a Network Dependencies package (available from the ROBOTC downloads page). The building license file must also be properly installed on the network in order for networked computers to access ROBOTC.