Closed nickallen74 closed 3 years ago
Unfortunately, getting useful error messages would require a redesign of the entire stream API as all methods just return a tresult which never contains any useful error message.
They would just need to add some IO specific members to the tresult
enum, e.g. kPermissionDenied
no plan for now to update this class
The FileStream class in the SDK is a thin wrapper around the C FILE* type. Unfortunately when using this for writing the actual writing happens in the fclose method (as fwrite calls are likely just into a buffer in RAM). The fclose method is only called in the FileStream destructor and any error code from fclose is silently ignored.
Doing the actual writing to disk when the ref count goes to 0 is not a good idea and swallowing up the error code and not being able to report it to the user in a meaningful way (eg disk full, permission denied) is bad programming practice.
Suggestion would be to add an explicit close method to the FileStream class so that when writing something to the stream it is possible to know for sure whether the write succeeded .
Unfortunately, getting useful error messages would require a redesign of the entire stream API as all methods just return a tresult which never contains any useful error message.