How to convert 'System::Object __gc *' to 'float array '

V

viks

Hi guys

I need little help here .
I want to convert 'System::Object __gc * array ' to 'float array'

Lets say I have object Reader with method Send ,it returns a variant
that contains a one-dimensional array of float value .

I m trying to do something like this.

float analogdata[5];

analogdata = Reader->Send ;

When I try this I get following error.
error C2440: '=' : cannot convert from 'System::Object __gc *' to
''float [5]'


Please help me out here :(

thanks
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

Hi guys

I need little help here .
I want to convert 'System::Object __gc * array ' to 'float array'

Lets say I have object Reader with method Send ,it returns a variant
that contains a one-dimensional array of float value .

I m trying to do something like this.

float analogdata[5];

analogdata = Reader->Send ;

When I try this I get following error.
error C2440: '=' : cannot convert from 'System::Object __gc *' to
''float [5]'

If I remember correctly you can not assign to an array, nor may you
return an array. You can however assign to a pointer an you can also
return a pointer. In other words try 'flot* analogdata;'.

Erik Wikström
 
R

Roland Pibinger

When I try this I get following error.
error C2440: '=' : cannot convert from 'System::Object __gc *' to
''float [5]'

This is not C++ but C++/CLI, the Microsoft hybrid language between C++
and C#. Try to ask in a newsgroup dedicated to C++/CLI.
 
V

viks

Roland said:
When I try this I get following error.
error C2440: '=' : cannot convert from 'System::Object __gc *' to
''float [5]'

This is not C++ but C++/CLI, the Microsoft hybrid language between C++
and C#. Try to ask in a newsgroup dedicated to C++/CLI.

who said its not C++ ??
 
A

Alf P. Steinbach

* viks:
Roland said:
When I try this I get following error.
error C2440: '=' : cannot convert from 'System::Object __gc *' to
''float [5]'
This is not C++ but C++/CLI, the Microsoft hybrid language between C++
and C#. Try to ask in a newsgroup dedicated to C++/CLI.

who said its not C++ ??

The error message makes it clear that the context is not C++. While the
question may very well turn out to be pure C++, in such a case it's
usually a waste of time to play detective in order to find some possible
C++ content. So even though your question turned out to actually be
meaningful also in C++ (invalid assignment to array), by including
non-C++ context you've basically cut yourself off from answers from most
C++ experts, and you /do not know/ whether answers based on pure C++ are
valid, because the rules in an extended language may be different.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top