JCL Help:StrAllocW

From Project JEDI Wiki
Jump to navigationJump to search


Summary

Allocates a buffer for a null-terminated wide string.


Pascal

 function StrAllocW(WideSize: SizeInt): PWideChar;


Parameters

Parameters Description
Size Size of the string to allocate in terms of characters. This indicates the total number of characters, including the null terminator. Thus, to allocate a buffer to hold the string 'Project JEDI' you must use at least 13 as the Size argument.


Return Value

Pointer to the first character of the allocated string.


Description

Allocates a buffer for a null-terminated wide string and returns a pointer to the first character. The string is initially empty and initialized to all zeros. When you are done using the string you must deallocate the memory by using StrDisposeW. Do not simply pass it to FreeMem.


About

Unit

JclWideStrings


Donator

Mike Lischke


Notes

The function allocates SizeOf(Cardinal) more memory then you requested. This additional Cardinal is stored at offset -4 of the returned pointer and is used to hold the size of the buffer. You can use the StrBufSizeW function to query for this value.


Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page