質問

Do I need to free the strings I get from those functions? Or maybe the system keeps track of them. Same question goes for GetCommandLine().

役に立ちましたか?

解決

You are responsible for allocation and deallocation of the buffers sent to MultiByteToWideChar and WideCharToMultiByte.

The return value from GetCommandLine is handled by Win32.

他のヒント

For the Unicode conversion functions you need to allocate memory to hold the converted strings. You are in charge of the lifetime of this memory.

For GetCommandLine you don't need to free the returned block of memory.

A very basic rule of thumb is that you have to deallocate if and only if you allocated the memory.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top