> ## 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.

# XAsyncGetResultSize

> XAsyncGetResultSize

# XAsyncGetResultSize

傳回要傳遞給 [XAsyncGetResult](/zh-TW/reference/system/xasyncprovider/functions/xasyncgetresult) 之緩衝區所需的大小。

## 語法

```cpp theme={null}
HRESULT XAsyncGetResultSize(  
         XAsyncBlock* asyncBlock,  
         size_t* bufferSize  
)  
```

### 參數

*asyncBlock*   \_Inout\_\
類型：[XAsyncBlock\*](/zh-TW/reference/system/xasync/structs/xasyncblock)

傳遞給非同步呼叫之 [XAsyncBlock](/zh-TW/reference/system/xasync/structs/xasyncblock) 的指標。

*bufferSize*   \_Out\_\
類型：size\_t\*

保存結果所需緩衝區的必要大小 (以位元組為單位)。

### 傳回值

類型：[HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

如果成功，會傳回 `S_OK`；否則會傳回錯誤碼。如需錯誤碼清單，請參閱[錯誤碼](/zh-TW/reference/errorcodes)。

## 備註

如果非同步呼叫會傳回結果，請在呼叫 [XAsyncGetResult](/zh-TW/reference/system/xasyncprovider/functions/xasyncgetresult) 之前呼叫此函式，以指定保存結果所需的緩衝區大小。每個會傳回結果的非同步呼叫都必須有對應的函式，可供呼叫以傳回該非同步呼叫的結果。

如需具有對應函式來傳回結果的非同步呼叫範例，請參閱 [XGameSaveGetRemainingQuotaAsync](/zh-TW/reference/system/xgamesave/functions/xgamesavegetremainingquotaasync) 和 [XGameSaveGetRemainingQuotaResult](/zh-TW/reference/system/xgamesave/functions/xgamesavegetremainingquotaresult)。

## 需求

**標頭：** XAsync.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

## 概念文件

* [非同步程式設計模型](/zh-TW/build/core-features/common/async/async-programming-model)
* [偵錯遊戲存檔](/zh-TW/build/core-features/common/game-save/game-saves-debugging)

## 另請參閱

[XAsync 成員](/zh-TW/reference/system/xasync/xasync_members)\
[XAsyncGetStatus](/zh-TW/reference/system/xasync/functions/xasyncgetstatus)\
[非同步程式設計模型](/zh-TW/build/core-features/common/async/async-programming-model)


## Related topics

- [XAsyncGetResultSize](/reference/system/xasync/functions/xasyncgetresultsize.md)
- [XAsync](/reference/system/xasync/xasync_members.md)
- [XAsyncCancel](/reference/system/xasync/functions/xasynccancel.md)
- [XAsyncBlock](/reference/system/xasync/structs/xasyncblock.md)
