Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Details on the Microsoft multi-string format

Tags:

c++

c

string

msdn

In some of its API function Microsoft use the "multi-string" format to specify a list of strings.

As I understand it, a multi-string is a null-terminated buffer of concatenated null-terminated strings. But this can also be interpreted as a list of strings, separated by a null character and terminated by two null characters.

Here comes an example. A list composed of the following items:

"apple", "banana", "orange"

Becomes:

apple\0banana\0orange\0\0

But now I wonder:

How would an empty list be represented ?

Would it be:

\0

Or:

\0\0

I failed to found an accurate documentation that clarifies this. Any clue ?

like image 474
ereOn Avatar asked Aug 26 '10 15:08

ereOn


2 Answers

It would be \0.

Raymond Chen describes how this works on his blog: the list of strings is terminated by an empty string. If the first string in the list is empty, the list itself is empty.

like image 69
James McNellis Avatar answered Sep 21 '22 07:09

James McNellis


\0

like image 39
dan04 Avatar answered Sep 21 '22 07:09

dan04