Null terminated strings...

S

Steve Barnett

I need to call a Win32 function that returns a set of string values. Each
value is terminated by a null and the last value is terminated by two nulls.
How do I code for this in C#?

The call is:
[DllImport("Kernel32.dll")]
internal static extern uint QueryDosDevice(string lpDeviceName,
string lpTargetPath,uint ucchMax);

According to the help, if lpDeviceName is NULL, the function retrieves a
list of all existing MS-DOS device names. Each null-terminated string stored
into the buffer is the name of an existing MS-DOS device.

Do I need to retrieve the buffer as a char array and process it myself? Can
I retrieve it as a string and use Split to split it in to an array?

Thanks
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top