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.
下面是这样的情况:我有一个类,其中有一个方法,我有一个循环,每次迭代用一个新字母覆盖一个缓冲区,缓冲区的数据类型是LPSTR。
My question is, how I could take all the letters that are generated in the loop and return them as a char array?
我的问题是,如何获取循环中生成的所有字母并将它们作为char数组返回?
1 个解决方案
#1
1
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;
}
#1
1
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;
}