C++ Add LPSTR buffer to char array

768 Views Asked by At

Here is the situation:
I have a class in which has a method in which I have a loop that overwrites a buffer with a new letter every iteration and the buffer's datatype is LPSTR.

My question is, how I could take all the letters that are generated in the loop and return them as a char array?

1

There are 1 best solutions below

2
On

I hope I understood you correctly, but from what I read I gathered you're trying to do something like this:

char buffer[256];
for(int i = 0, char c; (c = someAction()) != NULL && i < 256; ++i) {
    buffer[i] = c;
}