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

# PFEntityGetEntityKey

> 获取实体的 PFEntityKey。

获取实体的 PFEntityKey。

## 语法

```cpp theme={null}
HRESULT PFEntityGetEntityKey(  
    PFEntityHandle entityHandle,  
    size_t bufferSize,  
    void* buffer,  
    const PFEntityKey** entityKey,  
    size_t* bufferUsed  
)  
```

### 参数

**`entityHandle`**   PFEntityHandle

从身份验证调用返回的 PFEntityHandle。

**`bufferSize`**   size\_t

PFEntityKey 的缓冲区大小。所需大小可通过 PFEntityGetEntityKeySize 获取。

**`buffer`**   void\*<br />\**Out\_writes\_bytes\_to*(bufferSize,*bufferUsed)*

用于 PFEntityKey 及其字段的字节缓冲区。

**`entityKey`**   [PFEntityKey\*\*](/services/playfab/api-references/c/pftypes/structs/pfentitykey-c)<br />*库分配的输出*

待定

**`bufferUsed`**   size\_t\*<br />*可选输出*

所提供缓冲区中已使用的字节数。

### 返回值

类型：HRESULT

此 API 操作的结果代码。

## 备注

entityKey 是指向 buffer 内部的指针，无需单独释放。

## 要求

**头文件：** PFEntity.h

## 另请参阅

[PFEntity 成员](/services/playfab/api-references/c/pfentity/pfentity_members)


## Related topics

- [PFEntityIsTitlePlayer](/zh-CN/services/playfab/api-references/c/pfentity/functions/pfentityistitleplayer.md)
- [Android 快速入门](/zh-CN/services/playfab/sdks/c/quickstart-android.md)
- [GDK 快速入门](/zh-CN/services/playfab/sdks/c/quickstart-gdk.md)
- [iOS 快速入门](/zh-CN/services/playfab/sdks/c/quickstart-ios.md)
- [Linux 快速入门](/zh-CN/services/playfab/sdks/c/quickstart-linux.md)
