- Joined
- Mar 28, 2008
- Messages
- 666
- Reaction score
- 20
- Points
- 33
Hello,
i want to parse a connected char array to an array of strings.
In the char array, '\0' is used to seperate the string.
After the '\0' is a number, in this case 456.
The problem is that \0456 will be replaced by the assci sign 456.
So how I can initialize the char array right instead of this?:
Background:
i want to parse a connected char array to an array of strings.
In the char array, '\0' is used to seperate the string.
After the '\0' is a number, in this case 456.
The problem is that \0456 will be replaced by the assci sign 456.
So how I can initialize the char array right instead of this?:
Background:
Code:
char charArray[] = "ABC\0456\0"
void getStringArraysFromCharArray()
{
int n_woerter = 0;
for (int i=0; i<sizeof(charArray); i++)
{
if (charArray[i] == '\0') n_woerter++;
}
String *woerter = new String[n_woerter];
int d_ptr = 0;
for (int i=0; i<n_woerter; i++)
{
woerter[i].concat(&charArray[d_ptr]);
d_ptr += woerter[i].length() + 1;
}
...
}
Last edited: