platform/platform.c
/*	Returns a system error message.
*/
Returns a system error message.
Returns a system error message .
char *plGetSystemError(void)
{
#ifdef _WIN32
	char	*buffer = NULL;
	int		error;
	error = GetLastError();
	if (error == 0)
		return "Unknown system error!";
	if (!FormatMessage(
		FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
		NULL,
		error,
		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
		(LPSTR)&buffer,
		0, NULL))
		return "Failed to get system error details!";
	strcpy(sys_error, _strdup(buffer));
	LocalFree(buffer);
	return sys_error;
#else
	strcpy(sys_error,dlerror());
	return sys_error;
#endif
}
char * plGetSystemError ( void ) { #ifdef _WIN32 char * buffer = NULL ; int error ; error = GetLastError ( ) ; if ( error == 0 ) return " " ; if ( ! FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS , NULL , error , MAKELANGID ( LANG_NEUTRAL , SUBLANG_DEFAULT ) , ( LPSTR ) & buffer , 0 , NULL ) ) return " " ; strcpy ( sys_error , _strdup ( buffer ) ) ; LocalFree ( buffer ) ; return sys_error ; #else strcpy ( sys_error , dlerror ( ) ) ; return sys_error ; #endif }
Returns a system error message.
Returns a system error message .