Developers.Topic.CallingTwiceForBufferLength: Difference between revisions
Jump to navigation
Jump to search
(Importing page from Tikiwiki) |
m (1 revision) |
Latest revision as of 20:09, 20 June 2009
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