473,323 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

array as output parameter ???

Hi,

I have a function that creates an array and want to use that array in the client.
but what is the syntax in C++.NET 2005 to specify an array as output param of a function ??

ref class Test
{
void OutputParam(array<int>^ intArr)
{
intArr = gcnew array<int>(3);
for(int i=0; i<intArr->Length; i++)
intArr[i] = i*2;
}
};

Client :
r = gcnew Test();

array<int>^ intArr1 = nullptr;
r->OutputParam(intArr1);
for(int i=0; i<intArr1->Length; i++) --> CRASH
Console::Write(" {0}",intArr1[i]);

I tried
void OutputParam(array<int>^ intArr)
void OutputParam(array<int>^^ intArr)

but nothing works...

thanks
Chris


************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 17 '05 #1
1 1534
void OutputParam(array<int>^% intArr)

"Chris C" <cm****@yahoo.com> wrote in message
news:Oh**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a function that creates an array and want to use that array in the
client.
but what is the syntax in C++.NET 2005 to specify an array as output param
of a function ??

ref class Test
{
void OutputParam(array<int>^ intArr)
{
intArr = gcnew array<int>(3);
for(int i=0; i<intArr->Length; i++)
intArr[i] = i*2;
}
};

Client :
r = gcnew Test();

array<int>^ intArr1 = nullptr;
r->OutputParam(intArr1);
for(int i=0; i<intArr1->Length; i++) --> CRASH
Console::Write(" {0}",intArr1[i]);

I tried
void OutputParam(array<int>^ intArr)
void OutputParam(array<int>^^ intArr)

but nothing works...

thanks
Chris


************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: burdeen | last post by:
I've been trying to return an array with PHP5 soap. Is this not supported? or am i doing it wrong? Seems to return on the last element in the array. In my WSDL i've defined my return type as a...
1
by: beliavsky | last post by:
Suppose I define a trivial class composed of x and y coordinates and create a Numeric array of instances of that class. class xy: def __init__(self,x=0.0,y=0.0): self.x = x self.y = y def...
8
by: Gactimus | last post by:
I made the program below. It outputs the smallest number in the array. What I would like to know is how do I output the array location. I am at a loss. For example, since the smallest number in...
6
by: surrealtrauma | last post by:
i have a trouble about that: i want to ask user to enter the employee data (employee no., name, worked hour, etc.), but i dont know how to sort the data related to a particular employee as a...
6
by: Pavils Jurjans | last post by:
Hello, I think this is classical problem, but I can't figure out how to do it in most right way (I know ineffective way though ;) So, I have this method that does some database work and has to...
9
by: Alan Silver | last post by:
Hello, I'm a bit surprised at the amount of boilerplate code required to do standard data access in .NET and was looking for a way to improve matters. In Classic ASP, I used to have a common...
0
by: Moshe Kravchik | last post by:
Hi! I have a following problem. I have a web service (written in ATL Server). It has 2 function, lets name them getData and setData. The getData returns a byte array, setData receives a byte...
17
by: Chad | last post by:
I'm want static char *output; to hold the modified string "tel chad" However, when I debug it, static char *output holds the ascii value of the strng, and not the string itself. Here is...
13
by: Jack | last post by:
I have a class called "Base". This class has a protected member variable "m_base" which can be retrieved using the public member function "GetBaseMember". "m_base" is initialized to "1" and is...
7
by: arnuld | last post by:
this programme gives unusual output. i am not able to find out where the semantic bug lies: /* C++ Primer - 4/e * * an example from section section 7.2.4, page 241 * STATEMENT * write a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.