RealDocs

FName::GetPlainANSIString

function Core Since 4.0
#include "UObject/NameTypes.h"
Access: public

Description

Copies the name string without its numeric suffix into a fixed-size ANSI character buffer. No allocation — suitable for low-level or interop contexts that require a plain char array.

Caveats & Gotchas

  • Must only be used when the FName was originally stored as ANSI. Calling this on a wide (UTF-16) FName will produce garbage or assert in debug builds — call GetPlainWIDEString for wide names. Check the name's encoding with FNameEntry::IsWide() if unsure.
  • The output buffer is always NAME_SIZE (1024) characters. There is no returned length — the string is null-terminated within that buffer.
  • This is intended for low-level engine code and C-library interop. Most application code should use GetPlainNameString() which returns a safe FString.

Signature

CORE_API void GetPlainANSIString(ANSICHAR(&AnsiName)[NAME_SIZE]) const

Parameters

Name Type Description Default
AnsiName ANSICHAR(&)[NAME_SIZE] Fixed-size ANSI char buffer to receive the name. Must be exactly NAME_SIZE characters.

Return Type

void

Example

Pass a plain ANSI name to a third-party C library C++
ANSICHAR NameBuf[NAME_SIZE];
MyFName.GetPlainANSIString(NameBuf);
ThirdPartyLib_Register(NameBuf); // C API expecting char*

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.