I'd like to jump in here to correct a possible misconception... (:-)) On Tue, Aug 04, 2015 at 04:48:59PM -0400, Michael Gogins wrote: > > In C and C++ "char" is a number representing one character of text. > ASCII and UTF8 characters are one byte in size (8 bits). UTF-8 characters may actually be up to *3* bytes long.. If the character is not in the ASCII set, special coding is used to represent the character, and this can take up to 3 bytes. So if you're just using plain English text (as a score will usually be), you don't have to worry, but if you have accented characters or such, you need to be aware that the string may be longer than it appears. The strlen function that Michael mentions, though, will always give you the actual number of bytes (minus the required terminating NULL). Other common coding schemes such as ISO-8859 *are* strictly one byte per char, so they can represent the 128 ASCII ones, plus 128 more... > In C and C++, > a "string" is an array of char that terminates in a null character > '\0'. A pointer to the first character in the array is also a pointer > to the entire array, the entire string. So a string is typically > represented by a pointer to char, "char *". It might also be good to point out here that a 'C string" of the above type is a bit different from the C++ "std::string" class that you may have encountered. The latter manages its own memory needs, so you don't have to worry about allocating space. To get the actual "char*" string, though, you have to use its member function "c_str()". > (the other (:-)) -- Pete -- ------------------------------------------------------------------------------ _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net