|
Let's say you have a class in C#.
And both project are under your solution.
Go to c++/cli project setting, and add a reference by projects, and select a project c#.
When in c++/cli:
using namespace projectCSharNamespace;
projectCSharpClass ^cl = gcnew projectCSharpClass();
cl->String.
But why do you want as String^ *, instead yust String^
|
|
|
|
|
the C++/CLI function will be returning a value in the string passed in.
sort of like in c#
void GetName(ref string nameStr)
{
nameStr = "sam";
}
in c++ it would be
void GetName(string^ * nameStr)
{
*nameStr = "sam";
}
The problem happened when I tried to call c++ from c# since c# doesn't understand * unless it's unsafe.
|
|
|
|
|
As i coud see with docmetation, (Nothing at all) And my test, i coud see that it isn't possible to do as reference. Why don't you use as return. If you wan't a multiple variables, you coud use struct.
This coud be a bug, missing features or left out Intentionaly.
|
|
|
|
|
I figured it out. if you want to pass variables around as reference in C++/CLI you have to mark them with a %.
so instead of
void GetName(String ^ * name)
{
*name = "sam";
}
you do this:
void GetName(String^% name)
{
name = "Sam";
}
then you call it from c# like this:
String nameStr;
GetName(ref nameStr);
|
|
|
|
|
Thanks ByStorm. You saved my life. Been searching for this for weeks.
|
|
|
|
|
hi all,
i am writing a C programin Linux.
i want to make a system call and assign its result in to a variable.
how can i do this?
thanks in advance
|
|
|
|
|
i have found the answer myself and writing it down here;
popen() function did the work for me
Library: stdio.h
Prototype: FILE *popen(const char *command, const char *type);
Syntax: FILE *fp;
fp = popen( "ls -l", "r");
Notes:
command - is the command to be issued.
type - r - read O/P from command.
- w - Write data as I/P to command.
|
|
|
|
|
I'm glad you found your answer. If you have more questions, please ask in the right forum, this one is for managed C++ only.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
which forum could i ask that question? i havent seen a forum about C.
|
|
|
|
|
He means the "Visual C++ / MFC" forum, because it is a more general forum.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
There is no such thing as mananged C, AFAIK. Therefore, C questions end up in the visual C++ forum.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
hello to everybody.
i have a problem about polynomials by using c which includes a link command to mupad. but i am new at c++ and mupad programmes, and i cant find examples about the mixture of c and mupad.
1) the c programme must be able to take the degree and constants and sensitivity of the polynomial from user.
2) the programme must be able to find a root of the polynomial with a given initial value by using Newton-Raphson method.
3) the programme must be able to sense that is subjected to multiple root, and it must be able to prevent the negativities of this condition.
4) and the programme must do the steps 2 and 3 by using mupad.
if somebody can help me about this soon, i will be very grateful.
have a nice day to everybody...
|
|
|
|
|
What on earth is mupad ? Does it have something to do with the .NET framework, or are you in the wrong forum ? Either way, this smells like homework to me.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Christian Graus wrote: What on earth is mupad ?
MuPad[^]...
A pretty cool tool, used it in a course once...As far as tying it into .NET, I am not too sure.
If you try to write that in English, I might be able to understand more than a fraction of it. - Guffa
|
|
|
|
|
As looking at the web page, you can install on:
Windows, MacOS X, Linux
There is no way .NET framework is build for MacOS X, Linux.
It is pointless, to buil MuPad with .NET especaly for windows, but corp can use c++ cross-platform files, for maintaing is a lot easier, a lot cheaper, and the same techonlogy. And betwen them is very little diffrence in code. The Only big diffrence is Prebuild libraries for specific OS.
And you are defently in the wrong forum.
|
|
|
|
|
bsaksida wrote: And you are defently in the wrong forum.
I'm not but maybe the OP is...
--- modified
I didn't think there was a way to tie MuPad into .NET
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
Hi friends. I'm a new programmer. In an application, when i click About menu, i want my About.h dialog form to display. In the MSDN library, i saw such an example to display user defined dialogs;
{
Form ^ f = gcnew Form();
f->ShowDialog();
}
And i changed this code to display my About.h form dialog such as;
{
Form ^ About = gcnew Form();
About->ShowDialog();
}
But, i still see the same empty dialog instead of my About.h form. So how can i display this dialog when i click About menu ?
|
|
|
|
|
You're creating an empty form, an instance of the base Form class. You need to create an instance of the about dialog class, which will be derived from Form. If it's called AboutForm, then do this:
AboutForm ^ f = gcnew AboutForm();
f->ShowDialog();
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I saw this sample in also MSDN and tried many times, but compiler says AboutForm and f are unknown identifiers. Is there anything else i missed ?
|
|
|
|
|
I said 'if your about form is called 'AboutForm'. I have no idea what it's called, and obviously it needs to be in scope where you're trying to call it.
If you don't understand these things, you should stop playing with Managed C++, and also with any sort of GUI code, and work through a basic C++ book.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Of course, i modified the codes u send with respect to my Form's name, but there is still same error... Unknown identifiers...
|
|
|
|
|
Then your problem is probably to do with your #include settings. It's impossible to say, based on what you've told me, I'd need to see the code.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I am trying to run this packet logging/sending program for a game; which is coded within the Microsoft Visual Studio 6.0 C++ enviorment, however when I try executing it says's "This application has failed to start because the application is incorrect. Reinstalling the application may fix this problem.” any idea's?
-h7h7
|
|
|
|
|
h7h7 wrote: which is coded within the Microsoft Visual Studio 6.0 C++ enviorment,
This means it was not written using Managed C++, and you're in the wrong forum
When you find the right one, no-one can help you based on what you've said, you need to set breakpoints or otherwise work out where the program is crashing, so we can see some code to comment on.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Can anyone please recommend a book that is a good guide for beginners to the STL Library. I purchased one book that was supposedly for beginners, the C++ Standard Template Library, and it is so confusing i cant understand it. I would appreciate someone's help with this.
|
|
|
|