If someone could help me out that would be great! I'm trying to assign values to an array of std::strings, declared from gSOAP as follows:
Then I try to assign values like this:Code:class bla { public: std::string* *__ptr; int __size; struct soap *soap; };
I'm using a vector only because that's the only thing I found that actually compiles, but running this code gives a runtime error; I suspect &v.back() is at fault.Code:bla* user = new bla; bla->__size = 5; bla->__ptr = (std::string **)soap_malloc(bla->soap, sizeof(std::string *) * bla->__size); std::vector <std::string> v; for (int i=0; i < 5; i++) { v.push_back(someFunctionReturningC_STR(i)); bla->__ptr[i] = &v.back(); }
So I have 2 questions, 1) how do I assign string data to my array? (although in my example the array is of fixed length, in my application the array will not be fixed), and 2) can you get a pointer to a specific element of the vector data? to read only, not to write...
Thanks
Luc