> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 取得遊戲儲存空間服務設定的配額資訊

> 透過 XblTitleStorageGetQuotaAsync 擷取服務設定與儲存類型之 XBOX 遊戲儲存空間配額與已使用位元組的 flat C 程式碼範例。

本主題使用下列 flat C 程式碼範例，示範如何取得 XBOX 遊戲儲存空間中指定服務設定與儲存類型的配額資訊。

<Note>對於 `TrustedPlatform ` 儲存類型，要求會針對呼叫端玩家的 XBOX 使用者 ID 發出。</Note>

#### Flat C

```cpp theme={null}
auto asyncBlock = std::make_unique<XAsyncBlock>();
asyncBlock->queue = queue;
asyncBlock->context = nullptr;
asyncBlock->callback = [](XAsyncBlock* asyncBlock)
{
    std::unique_ptr<XAsyncBlock> asyncBlockPtr{ asyncBlock };   // Take over ownership of XAsyncBlock*.
    size_t usedBytes;
    size_t quotaBytes;
    HRESULT hr = XblTitleStorageGetQuotaResult(asyncBlock, &usedBytes, &quotaBytes);
};

HRESULT hr = XblTitleStorageGetQuotaAsync(
    xboxLiveContext,
    scid,
    storageType,
    asyncBlock.get()
);

if (SUCCEEDED(hr))
{
    // The call succeeded, so release  std::unique_ptr ownership of XAsyncBlock* because
    // the callback takes over ownership. If the call fails, however, std::unique_ptr keeps
    // ownership and deletes XAsyncBlock*.
    asyncBlock.release();
}
```

## 另請參閱

[XAsyncBlock](/zh-TW/reference/system/xasync/structs/xasyncblock)

[XblTitleStorageGetQuotaAsync](/zh-TW/reference/live/xsapi-c/title_storage_c/functions/xbltitlestoragegetquotaasync)

[XblTitleStorageGetQuotaResult](/zh-TW/reference/live/xsapi-c/title_storage_c/functions/xbltitlestoragegetquotaresult)


## Related topics

- [遊戲儲存空間範例程式碼](/zh-TW/services/xbox-services/storage/title-storage/how-to/live-title-storage-howto-nav.md)
- [操作說明](/zh-TW/services/xbox-services/storage/title-storage/how-to/index.md)
- [全域儲存空間工具 (GlobalStorage.exe)](/zh-TW/tools/tools-services/live-global-storage-tool.md)
- [連線儲存空間與遊戲儲存空間](/zh-TW/services/xbox-services/storage/live-connected-storage-vs-title-storage.md)
- [遊戲儲存空間](/zh-TW/services/xbox-services/storage/title-storage/index.md)
