char buffer[1024] = {0};
pos = 0;
size_t i;
bool done = false;
while (not done) {
char * nextChunk = GetMoreData();
if (nextChunk != nullptr) {
for(i = 0; i < nextChunk.size(); i++) {
buffer[pos] = nextChunk[i];
pos++;
}
} else {
done = true;
}
}
struct MyStruct{
...
};
void Fix(MyStruct * & ptr) {
...
ptr = new MyStruct
...
}
...
MyStruct * x;
x = new MyStruct;
Fix(x);
delete x;