Tim Van Wassenhove

Passionate geek, interested in Technology. Proud father of two

01 Mar 2006

More marshalling...

This snippet uses GetPrivateProfileString that is available in kernel32.dll. Apparently microsoft has decided to remove this useful function from the dotnet api.

[DllImport("kernel32", SetLastError=true)]
extern int GetPrivateProfileString(
String ^pSection,
String ^pKey,
String ^pDefault,
StringBuilder ^pValue,
int pBufferLen,
String ^pFile

StringBuilder ^buf = gcnew StringBuilder(256);

std::string \_log\_file = new string(
(char*) Marshal::StringToHGlobalAnsi(logf).ToPointer()