1. #define STEAM_API_NON_VERSIONED_INTERFACES
  2. #include <Steamworks.h>
  3.  
  4. int main(int argc, char* argv[])
  5. {
  6.     if (!SteamAPI_Init())
  7.     {
  8.         return 1;
  9.     }
  10.  
  11.     ISteamUserStats002 *userStats = (ISteamUserStats002 *)SteamClient()->GetISteamUserStats(SteamAPI_GetHSteamUser(), SteamAPI_GetHSteamPipe(), STEAMUSERSTATS_INTERFACE_VERSION_002);
  12.  
  13.     CGameID gameId(440);
  14.  
  15.     if (!userStats->RequestCurrentStats(gameId))
  16.     {
  17.         std::cout << "Unable to request stats for " << gameId.AppID() << ", no game ownership or game does not exist." << std::endl;
  18.     }
  19.  
  20.     uint32 maxStats = userStats->GetNumStats(gameId);
  21.     if (maxStats > 0)
  22.     {
  23.         std::cout << "Stats:" << std::endl;
  24.         for (uint32 x = 0; x < maxStats; x++)
  25.         {
  26.             const char *name = userStats->GetStatName(gameId, x);
  27.             std::cout << name << std::endl;
  28.         }
  29.     }
  30.  
  31.     std::cout << std::endl;
  32.  
  33.     uint32 maxAchievements = userStats->GetNumAchievements(gameId);
  34.     if (maxAchievements > 0)
  35.     {
  36.         std::cout << "Achievements:" << std::endl;
  37.         for (uint32 x = 0; x < maxAchievements; x++)
  38.         {
  39.             const char *name = userStats->GetAchievementName(gameId, x);
  40.             std::cout << name << std::endl;
  41.         }
  42.     }
  43.  
  44.     SteamAPI_Shutdown();
  45.  
  46.     return 0;
  47. }