本文介绍了如何将C ++控制台参数发送到C#DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将两个作为参数输入或由C ++控制台请求的数字发送到C#中的库。



手动代码为:

I need to send two numbers entered as parameters or requested by C++ console to a library in C#.

Manually the code is:

BSTR thing_to_send = ::SysAllocString(L"10 20");





如何使用控制台指示的参数值或类型的两个变量创建BSTR类型的变量整数或字符串。



我需要使用它们之间的空格来连接值,例如:



string Num1 = 30;

string Num2 = 40;

string dataToSend = Num1 ++ Num2;







string Num1 = argv [1];

string Num2 = argv [2];

string dataToSend

dataToSend + = Num1 +;

dataToSend + = Num2;



如何我可以将dataToSend转换为BSTR有效变量以发送:

dataToSend to BSTR?



我尝试了什么:



在每一页中我已经回顾了转换的其他类型的原点值,其中链的显式值类似于转换为Cade而不是使用变量,因为在这种情况下是



How can I create a variable of type BSTR using the values of the parameters indicated by the console or by two variables of type integer or string.

I need to concatenate the values using a space between them, for example:

string Num1 = 30;
string Num2 = 40;
string dataToSend = Num1 + " " + Num2;

or

string Num1 = argv[1];
string Num2 = argv[2];
string dataToSend
dataToSend += Num1 + " ";
dataToSend += Num2;

How I can convert dataToSend to BSTR valid variable to send with:
dataToSend to BSTR?

What I have tried:

In each page that I have reviewed other types of values of origin for the transformation are indicated, with explicit values of chain like being "Cade to convert" but not with the use of variables as it is in this case

推荐答案



这篇关于如何将C ++控制台参数发送到C#DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 06:40