Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have the an API that takes three parameters
BOOL GetServerName (int index, LPSTR Buffer, int BufSize);

how can i use this method in C#
what is the equivalence of LPSTR ?
Posted

There's built-in support for marshaling to LPSTR using the MarshalAs attribute.

You call would likely be something like this;

bool GetServerName(int index, [MarshalAs(UnmanagedType.LPStr)] string Buffer, int BufSize)


More detailed information on marshaling can be found here[^].

Hope this helps,
Fredrik
 
Share this answer
 
v2
lpstr-data-type[^]

Check the link..hope it will help..
 
Share this answer
 
Comments
mahua22 6-Aug-13 5:36am    
its working,thanks...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900