|
-
Nov 13th, 2005, 03:17 PM
#1
Thread Starter
Lively Member
Ideas on how to return value and alter array [Resolved]
Lo all, Im after some ideas on how I can do something. In my program a client connects to my server app. The server app recieves the data in a byte array which needs to be sorted into like Bytes, Int16, Int32, Strings etc etc. Anyway Ive made some functions to join parts of the byte array to make my Int16, Int32 and strings etc but I want to also remove what Ive just joined together from the array. eg.
Array is this first of all
Arr(0) = 1
Arr(1) = 2
Arr(2) = 3
Arr(3) = 4
Arr(4) = 5
Arr(5) = 6
I call the function say GetInt32(Arr) this would then return 1234
Then Id like the function to adjust array accordingly ie
Array is now
Arr(0) = 5
Arr(1) = 6
Is there anyway to do it within the function 'GetInt32'. I know I could just make another function to do it but Id love to get it into the same function but I dont think You can return 2 values lol. Any ideas
Last edited by Dilvid; Nov 14th, 2005 at 02:48 AM.
-
Nov 13th, 2005, 05:31 PM
#2
Re: Ideas on how to return value and alter array
Note that you are going to have to pass your array ByRef regardless of how you achieve this, because you are going to have to create a new array object. You could either create a new array of the appropriate size and then copy the appropriate elements, or you could add the array to a collection using AddRange, then Remove the appropriate items and then copy back to a new array.
-
Nov 13th, 2005, 05:39 PM
#3
Re: Ideas on how to return value and alter array
Post your function as it is now, and we can tell you how to make it adjust for size..
Bill
-
Nov 14th, 2005, 02:46 AM
#4
Thread Starter
Lively Member
Re: Ideas on how to return value and alter array
I got it sorted now, I just made a class called packet which had all the functions to get certain values and also a function to make the array smaller. I just pass the class location around instead of just the array
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|