[Solved] file handling I/O c++ error


You have p as some pointer. Who is going to allocate the memory that pointer points to?
In C it is almost always the responsibility of the caller to allocate any buffers before the call.
If you don’t want to, then use a std::string instead.

solved file handling I/O c++ error