Developers.Topic.CallingTwiceForBufferLength
Jump to navigation
Jump to search
the annoying but necessary trick of making the same win32 api call twice: first with null and 0 to just get the requird buffer length, then again to have it use that buffer and actually do what you want it to. even more annoying: remember to free the buffer or avoid a memory leak. and make sure the buffer is exactly the right size, one or two bytes per character?, includes null terminator or not? you actually saw a win32 call which acted one way on short text, and differently on really long text