GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Three — Data Types and Operators (continued)
Character arrays and strings are very similar. Both provide means to contain and alter text. For example:
char buffer[128];
buffer = "This is my string";
is similar to:
string buffer;
buffer = "This is my string";
However, in the first case the char array is limited to 128 characters (bytes) while the string is effectively unlimited (certain functions that process strings may be size limited). Whenever a character or byte array is referenced like a string, it will be treated as a string and the default zero termination applies. When a string is stored into a character array, only the valid zero-terminated portion of the string is written to the array. Any space after that will remain altered. For example:
char mystring[10];
mystring = "abcdefghi";
mystring = "123";
The contents of the ‘mystring’ is actually:
"123\0efghi\0"
Notice the \0 are actually binary zeroes. If the array was referenced as a string, the zero is considered the end of the string. For example:
MessageBox(mystring);
The result would display as “123”. However, the character array can be treated as a binary buffer and used in certain operations such as file reading and writing. In addition, when placed into an object with a fixed size (particularly if passed to a non-script function or as external data), the char data type has the advantage of being a fixed area of data that can be directly adjacent to other members of the same object.
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.