If you want to accumulate your data in a container, use std containers. vector would suffices as a good container for your job:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <vector>
usingnamespace std;
int main()
{
vector<DataType> dataReceived; //define data container
DataType buffer; //type of your data
while(recevingFromDevice) //loop that keeps running as long as you're receiving from your device
{
buffer = getDataFromDevice(); //buffer what you receive from the device
dataReceived.push_back(buffer); //add this buffer to the stack of data
}
//now dataReceived is an array with all received data
}