Using fstream C++ library in PlatformIO for Data Logging in esp32 based BLE Client


I wanted to know if C++ libraries like fstream can be used along with the Arduino Code in PlatformIO (in order to log data in a text file). Because it does not even run in Arduino IDE. In PlatformIO, the code compiles but there is no text file created. What I want to do is… I am receiving data via BLE to a esp32 based client device. The data will be logged directly to text files to be able to use later for ML purposes.

Is there any other way to log data? I don’t want suggestion for any third-party software. I want the code to do everything. I have already created a Python-based data logger but apparently, for other non-expert people, it will be hard to deal with so many things when they use our device.