Skip to content

JsStringToPointer

Limin Zhu edited this page Mar 14, 2017 · 2 revisions

Retrieves the string pointer of a string value.

Syntax

STDAPI_(JsErrorCode)
    JsStringToPointer(
    _In_ JsValueRef value,
    _Outptr_result_buffer_(*stringLength) const wchar_t **stringValue,
    _Out_ size_t *stringLength);

Parameters

  • value: The string value to convert to a string pointer.
  • stringValue: The string pointer.
  • stringLength: The length of the string.

Return Value

The code JsNoError if the operation succeeded, a failure code otherwise.

Remarks

This API is Windows-only (see JsCopyString/JsCopyStringUtf16 for cross-platform equivalent). This function retrieves the string pointer of a string value. It will fail with JsErrorInvalidArgument if the type of the value is not string. The lifetime of the string returned will be the same as the lifetime of the value it came from, however the string pointer is not considered a reference to the value (and so will not keep it from being collected). Requires an active script context.

Clone this wiki locally