Pregunta

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().

¿Fue útil?

Solución

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

The return value from GetCommandLine is handled by Win32.

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top