System.Chart[] when convert to string

J

jadlaxel

Hi,

I am using a DLL file to get a function. This has one parameter which
is a pointer. To access the function I do the following:

---------------------------------------------------------------------------------------------------
[DllImport("statax.dll")]
public static extern unsafe int fnReadMeas(char* buf);

---------------------------------------------------------------------------------------------------
Later on, in a button event I call this function as follows:

---------------------------------------------------------------------------------------------------
int Valor=0;
char[] m_BufMeas=new char[256];
fixed(char* DataRead=m_BufMeas)
{
Valor=fnReadMeas(DataRead);

if(Valor==1)
{
Mylabel.Text=Convert.ToString(m_BufMeas);
break;
}
}
---------------------------------------------------------------------------------------------------
On MyLabel I get the following text "System.Chart[]".
Any tip of how to solve this problem? I should be getting several
numbers in m_BufMeas.

Thanks in advance for your help.

Axel.
 
N

Nicholas Paldino [.NET/C# MVP]

Axel,

I assume that by System.Chart[], you mean System.Char.

You can pass that array to the constructor of the String class to create
the new string. Use the overload that takes the start index and the length,
in case not all 256 characters are used from the buffer (I assume the return
value of the unmanaged function will indicate the number of characters
written).
 

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