Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

.NET Client Classes for openldap/winldap

, 11 Mar 2003 CPOL
An example of using LDAP/OpenLDAP with .Net
/**************************************************************************
   THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF
   ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
   PARTICULAR PURPOSE.
   Author: Leon Finker  9/2002
**************************************************************************/
#pragma once

class CIntPtrStringAnsi
{
public:
	CIntPtrStringAnsi(const gcroot<String*> str)
	{
		m_p = (char*)Marshal::StringToCoTaskMemAnsi(str).ToPointer();
	}
	~CIntPtrStringAnsi() { Free(); }
	void Free()
	{ 
		if(m_p)
			Marshal::FreeCoTaskMem(IntPtr(m_p)); 
		m_p = 0;
	}
#ifdef WINLDAP_NET
	#if LDAP_UNICODE
		#error Unicode is not supported, code has to be modified to support Unicode
	#endif
	operator const PCHAR() { return m_p; }
#elif OPENLDAP_NET
	operator const char*() { return m_p; }
#endif
private:
	char* m_p;
private:
	CIntPtrStringAnsi(const CIntPtrStringAnsi&);
	CIntPtrStringAnsi& operator=(const CIntPtrStringAnsi&);
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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

Share

About the Author

Leon Finker

United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141216.1 | Last Updated 12 Mar 2003
Article Copyright 2003 by Leon Finker
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid