We do not have a readymade example in C++. You can refer to the control center source code for saving the data to a file.But it is in C#. You can follow the same algorithm in C++.
Also, in the below thread, you will find an example to store the incoming data in the C# streamer to a file.
- Madhu Sudhan