1) This is the CLI call Httpost example
#using <System.dll>
Using Namespace System;
Using Namespace System::Net;
Using Namespace System::Text;
Using Namespace System::Io;
Specify the URL to receive the request.
IntMain()
{
Array<String^>^Args= Environment::GetCommandLineArgs();
HttpWebRequest^Request= dynamic_cast<HttpWebRequest^> (WebRequest::Create(Args[ 1 ] ));
Set some reasonable limits on resources used by this request
Request-Maximumautomaticredirections = 4;
Request-maximumResponseHeadersLength = 4;
Set credentials to use for the this request.
Request-Credentials = CredentialCache::DefaultCredentials;
HttpWebResponse^Response= dynamic_cast<HttpWebResponse^> (Request-GetResponse());
Console::WriteLine( "Content length is {0}",Response-ContentLength );
Console::WriteLine( "Content type is {0}",Response-ContentType );
Get the stream associated with the response.
Stream^Receivestream=Response-GetResponseStream();
Pipes the stream to a higher level stream reader with the required encoding format.
StreamReader^Readstream=GcnewStreamReader( Receivestream,encoding:: utf8 );
console::writeline< Span class= "pun" > ( );
console::writeline< Span class= "pun" > ( Readstream->readtoend ); response->close (); Readstream->close ();}
2) This is the CLI string^ turn char * example
Using Namespace System::Runtime::InteropServices;void MethodName(){ String^Nowstring= Datetime::Now.Tostring("Yyyy-mm-dd-hh:mm"); IntPtrPtrtonativestring= Marshal::StringToHGlobalAnsi(Nowstring); Try { Cvcapture*Capture=Cvcreatecameracapture(0); Iplimage*Tosave=Cvqueryframe(Capture);Cvsaveimage(Static_cast<Char*> (Ptrtonativestring.ToPointer()),Tosave);Cvreleaseimage(&Tosave Cvreleasecapture (&capture } catch ( ...) { marshal:: Freehglobalptrtonativestring throw;} marshal:: Freehglobalptrtonativestring /span>
An example of a CLI