What's unclear is that the terminating null only counts when there's actually a string to return. I'm pretty sure that, as far as Windows is concerned, a valid string which happens to be zero length is not the same as a null pointer to a string which doesn't exist. But they don't bother to tell you that or anything. The docs should specify exactly what that value should be if a null string is returned.

Difficult string handling is the only thing which pisses me off about C. I'll bet that if you totaled up all of the bugs and crashes in Windows software throughout history, the majority of them could be traced back to string-related things like trashed pointers and strings which aren't bounds-checked. If C had been built with proper native string handling from the beginning, all our jobs would be a lot easier.

___________
Tony Fabris
_________________________
Tony Fabris