Files & storageSDL 3.2
SDL_GetPrefPath
A folder where your program may write: settings, save games, logs. Created if missing.
Signature
char * SDL_GetPrefPath(const char *org, const char *app);
How it works
Each system has its own place for per-user data: %APPDATA% on Windows, ~/Library/Application Support on macOS, ~/.local/share on Linux. SDL builds the right path from your organization and app names and creates the folder.
Keep the names stable: changing them later "loses" every player's saves.
Parameters
orgconst char *
Your studio or organization name.
appconst char *
Your application name.
Return value
The path, ending with a separator. It is yours: free it with SDL_free. NULL on failure.
Example
example.cpp
1char* prefs = SDL_GetPrefPath("MyStudio", "MyGame");
2std::string savePath = std::string(prefs) + "save1.dat";
3SDL_free(prefs);