Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Copying array elements

Author
Message
pdq
19
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 16th Aug 2013 19:14 Edited at: 16th Aug 2013 19:17
Is there a function "out there" that would enable me to copy the contents of one array element (including multiple fields) to another. For example:



I am trying to avoid this:


I was using Ian's Matrix ArrayPtr and peek/poke functions; however, dealing with multiple string fields has been a pain.

Thanks
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 16th Aug 2013 20:02
Actually, you can just copy an array as in your first snippet.

pdq
19
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 16th Aug 2013 23:53
Sorry, I meant to change the situation a bit.

What about this?



I get an error message when I try this, yet both arrays are the same type.
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 17th Aug 2013 00:02 Edited at: 17th Aug 2013 00:21
That works as well.



Can't say why it's giving you an error. I checked it on all versions from 7.4 up to the 7.7 beta
pdq
19
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 17th Aug 2013 02:00
I found my error. I defined the udt in another source file.

Thanks again.
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 17th Aug 2013 02:44 Edited at: 17th Aug 2013 02:52
You are welcome. If the other source file is included in the project and you either dimension the array in your main source file or call a subroutine in the other file to dimension the arrays, it will work. See download.

The problems not where you define the udt but where you dimension the udt arrays.

Login to post a reply

Server time is: 2026-07-07 03:47:24
Your offset time is: 2026-07-07 03:47:24