where does -> String Data Type comes from in freebasic like String, ZString, WString ?
a) it's c++ based and a string class? or b) in c the char type and creates
an array of characters to make a string? c) an own Data Type from quickbasic?
the freebasic String Functions of 'crt\string.bi' I cannot change the c runtime library Is fixed For using.
thanks, loewenherz
Code: Select all
' c
char greetings[] = "Hello World!";
printf("%s", greetings);
' c++
#include <string>
int main() {
// char-Array mit 12 Elementen
char a[] = "Hallo Welt!";
// char-Array mit 12 Elementen
std::string z = "Hallo Welt!";
}
Code: Select all
' freebasic
' zstring example
Dim As ZString * 1000 buffer
Dim As ZString * 1000 b2
buffer = "1234" + Chr(0) + "5678"
Print Len(buffer), buffer
Print
For x As Integer = 0 To 8
Print buffer[x],Chr(buffer[x])
Next
b2 = buffer
Print
Print Len(b2), b2
Print
For x As Integer = 0 To 8
Print b2[x],Chr(b2[x])
Next
Sleep
' string example
Dim As String buffers
Dim As String b2a
buffers = "1234" + Chr(0) + "5678"
Print Len(buffers), buffers
Print
For xa As Integer = 0 To 8
Print buffers[xa],Chr(buffers[xa])
Next
b2a = buffers
Print
Print Len(b2a), b2a
Print
For xa As Integer = 0 To 8
Print b2a[xa],Chr(b2a[xa])
Next
Sleep
header c++
Code: Select all
<cstring> (string.h)
C Strings
This header file defines several functions to manipulate C strings and arrays.
Functions
Copying:
memcpy Copy block of memory (function)
memmove Move block of memory (function)
strcpy Copy string (function)
strncpy Copy characters from string (function)
Concatenation:
strcat Concatenate strings (function)
strncat Append characters from string (function)
Comparison:
memcmp Compare two blocks of memory (function)
strcmp Compare two strings (function)
strcoll Compare two strings using locale (function)
strncmp Compare characters of two strings (function)
strxfrm Transform string using locale (function)
Searching:
memchr Locate character in block of memory (function)
strchr Locate first occurrence of character in string (function)
strcspn Get span until character in string (function)
strpbrk Locate characters in string (function)
strrchr Locate last occurrence of character in string (function)
strspn Get span of character set in string (function)
strstr Locate substring (function)
strtok Split string into tokens (function)
Other:
memset Fill block of memory (function)
strerror Get pointer to error message string (function)
strlen Get string length (function)
Macros
NULL Null pointer (macro)
Types
size_t Unsigned integral type (type)