The only hit on Google for Arp::BasicString
was used in the SDK for a software company, PLCnext. A little bit of riffling through I found a header file BasicString.hxx
and inside a prototype for BasicString
class template. There the baseString
data structure is private.
I had to come up with this (rather low-level) workaround, compiling with PLCnext software succeeded and passed tests when adjusted for std::string
):
String p = "10004F1F7";
const char* CMD_SEQUENCE = "SELECT * from TABELTAGGEGEVENS WHERE ID =";
const int CMD_LENGTH = 41;
// allocate and assign memory for the static characters in the command
char *sql = (char *)malloc(CMD_LENGTH * sizeof(char));
memcpy(sql, CMD_SEQUENCE, CMD_LENGTH);
// iterate through all chars in String p
// resizing the memory buffer as needed and adding ith char to the end
for (int i=0; i<p.Size();i++){
sql = (char*)realloc(sql, (CMD_LENGTH + i) * sizeof(char));
// destination is the ith memory cell past the cmd sequence
int destIdx = CMD_LENGTH + i;
// copy 1 char at a time; ith char in p
memcpy( &sql[destIdx], &p.At(i), sizeof(char) );
}