Returning a pointer from a function has its inherent dangers: the responsibility for the memory is passed to the caller, and the caller must ensure that the memory is appropriately de-allocated, otherwise this could cause a memory leak with a corresponding loss of performance. In this section, we will look at some ways that the Window's Software Development Kit (SDK) provides access to memory buffers and learn some techniques used in C++.
First, it is worth pointing out that any function in the Windows SDK that returns a string, or has a string parameter, will come in two versions. The version suffixed with A indicates that the function uses ANSI strings, and the W version will use wide character strings. For ...