Skip to content

JsCopyString

Alex Godoy Wolff edited this page Nov 16, 2016 · 6 revisions

Write JavascriptString value into C string buffer

Syntax

CHAKRA_API
       JsCopyString(
        _In_ JsValueRef value,
        _In_ int start,
        _In_ int length,
        _Out_opt_ char* buffer,
        _Out_opt_ size_t* written);

Parameters

  • value: JavascriptString value
  • start: Start offset of buffer
  • length: Length to be written
  • buffer: Pointer to buffer
  • written: Total number of characters written

Return Value

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

Remarks

When size of the buffer is unknown, buffer argument can be nullptr. In that case, written argument will return the length needed.

When start is out of range or < 0, returns JsErrorInvalidArgument and written will be equal to 0. If calculated length is 0 (It can be due to string length or start and length combination), then written will be equal to 0 and call returns JsNoError.

Clone this wiki locally