We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3578

Summary: Is possible to implement stdarg output into SDL_RWops (vfprintf-like output) natively without middle buffers?
Product: SDL Reporter: Vitaly Novichkov <admin>
Component: videoAssignee: Sam Lantinga <slouken>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: minor    
Priority: P2 CC: admin
Version: HG 2.1   
Hardware: All   
OS: All   

Description Vitaly Novichkov 2017-02-02 08:55:21 UTC
I had my own logger based on usage of vfprintf function which prints output log into the file with arguments sending into it without having extra buffer until I will send it into the stream. I trying to use SDL_RWops because of native UTF8 support in file paths (however, manual getting the FILE* descriptor from utf8 path is easy, but requires extra function calls on Windows to convert into UTF16 until I'll be able to call _wfopen()).

Would be cool if we can have SDL_RWprintV()-like function which receives format string with va_list thing which also would be useful to send formatted string DIRECTLY into real file stream without any middle buffers. The implementation I made over existing API uses vsnprintf with a middle buffer which is not a good solution (especially in a case when is needed to send buffer data directly into file stream).

Note: I know about SDL_Log, but because of 4096 buffer size limit in some cases may be not good. I also using logger to store crash dumps (which are may have any size)
Comment 1 Sam Lantinga 2017-08-11 17:56:55 UTC
Yes, this is a good idea for SDL 2.1