Copies the contents of a managed string into unmanaged memory, converting into ANSI format as it copies.
The address, in unmanaged memory, to where s was copied, or 0 if s is null.
Marshal.StringToHGlobalAnsi(string) is useful for custom marshaling or when mixing managed and unmanaged code. Because this method allocates the unmanaged memory required for a string, always free the memory by calling Marshal.FreeHGlobal(IntPtr). Marshal.StringToHGlobalAnsi(string) provides the opposite functionality of Marshal.PtrToStringAnsi(IntPtr).
This method copies embedded null characters, and includes a terminating null character.