Final Platform Layer 0.9.8-beta
No Matches
Query Platform/OS information

FPL provides a couple of functions for query operating system or platform information.

Get Current Platform Type/Name

Use fplGetPlatformType() to get the current fplPlatformType .
This can be useful to do different operations on different platforms.

Use fplGetPlatformName() to get a string representation for the given fplPlatformType .

fplPlatformType currentPlatform = fplGetPlatformType();
const char *platformName = fplGetPlatformName(currentPlatform);
fplConsoleFormatOut("Platform: %s\n", platformName);
fpl_common_api void fplConsoleFormatOut(const char *format,...)
Writes the given formatted text to the standard output console buffer.
fpl_common_api fplPlatformType fplGetPlatformType()
Gets the type of the platform.
fpl_common_api const char * fplGetPlatformName(const fplPlatformType type)
Gets the string representation of the given platform type.
An enumeration of platform types.

Query OS Version, Kernel, Distribution etc.

You can retrieve the version/name of your operating system by calling fplOSGetVersionInfos() .
See fplOSVersionInfos for more details.

if (fplOSGetVersionInfos(&infos)) {
fplConsoleFormatOut("Operating system name: %s\n", infos.osName);
fplConsoleFormatOut("Operating system version: %s.%s.%s.%s\n", infos.osName.major, infos.osName.minor, infos.osName.fix,;
#define fplZeroInit
Initializes a struct to zero.
fpl_platform_api bool fplOSGetVersionInfos(fplOSVersionInfos *outInfos)
Gets version informations from the operating system.
A structure that contains the version information for the operating system.
Name of the operating system.

Get current username

Use fplSessionGetUsername() to get the username for the current session.

char usernameBuffer[256];
if (fplSessionGetUsername(usernameBuffer, fplArrayCount(usernameBuffer))) {
fplConsoleFormatOut("Current username: %s\n", usernameBuffer);
#define fplArrayCount(arr)
Returns the element count from a static array. This should ideally produce a compile error when passi...
fpl_platform_api size_t fplSessionGetUsername(char *nameBuffer, const size_t maxNameBufferLen)
Gets the username of the current logged-in user from the session.