The api you are calling is likely returning a char* (or void*) and a length. Not really a Cstring. In other words “a binary string”.
In clarion a cstring “cannot” hold binary strings because they “terminate” on the first chr(0).
For api calls like this you should use either a string (remembering to kerp track of the length) or a variable length binary string (like stringtheory).
Outputting to debugview is also problematic. Because debugview takes cstrings as input, so terminates after the first chr(0). Plus of course you wont see non-printable binary chars.
I use stringtheory PeekRam method to inspect binary values. (You can just pass in the address and length, no need to assign.)
If it’s regarding this structure, can you show your clarion rendition? It could be possible that there’s an alignment problem, putting a zero where it shouldn’t be.
If you can find a http://pinvoke.net/ declaration it can often be helpful in Clarion. The types are closer and constants tend to be defined
typedef struct {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
TCHAR szPname[MAXPNAMELEN];
DWORD fdwSupport;
DWORD cDestinations;
} MIXERCAPS;
[StructLayout(LayoutKind.Sequential)]
struct MixerCaps
{
public ushort ManufacturerID;
public ushort ProductId;
public int Version;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)]
public String ProductName;
public uint Support;
public uint Destinations;
public override String ToString()
{
return String.Format(...);
}
}
and then consider if there is no terminator, perhaps something like:
x long,auto
code
x = instring(‘<0>’,szPname,1,1)
case x
of 0
string_ProductName = szPname ! no null terminator
of 1
string_ProductName = ''
else
string_ProductName = szPname[1 : x-1]
end