Hi again to all devs,
Is there any way to use copybytes to take a chunk out of an array? Say, to copy elements 0-10 of an array into another buffer, then concatenate elements 20-30 onto the end of it?
B3st Ed++
Lone Shark "Aviation" out now on http://www.pyramidtransmissions.com http://www.myspace.com/sharktracks
--------------------------------- Yahoo! Answers - Get better answers from someone who knows. Tryit now.
what is an array? is a C array? you may want to read: http://www.mkssoftware.com/docs/man3/memcpy.3.asp and more generally a good C book
It will not work. Here is our function prototype: EXTERN void *copybytes(void *src, size_t nbytes);
The thing to see here, is that it doesn't actually copy the data to a location you specify. It creates a copy of the data, somewhere in memory, and returns a pointer to the location. If you want to have a continuous array of numbers, you'd have to copy them one at a time from one array to the other anyhow.
I suggest to just use getbytes() and for loops to do the assignment.
Chuck
On 9/16/07, Ed Kelly morph_2016@yahoo.co.uk wrote:
Hi again to all devs,
Is there any way to use copybytes to take a chunk out of an array? Say, to copy elements 0-10 of an array into another buffer, then concatenate elements 20-30 onto the end of it?
B3st Ed++
Lone Shark "Aviation" out now on http://www.pyramidtransmissions.com http://www.myspace.com/sharktracks
Yahoo! Answers - Get better answers from someone who knows. Try it now. _______________________________________________ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Ah well, that's what I've done.
Cheers, Ed
Charles Henry czhenry@gmail.com wrote: It will not work. Here is our function prototype: EXTERN void *copybytes(void *src, size_t nbytes);
The thing to see here, is that it doesn't actually copy the data to a location you specify. It creates a copy of the data, somewhere in memory, and returns a pointer to the location. If you want to have a continuous array of numbers, you'd have to copy them one at a time from one array to the other anyhow.
I suggest to just use getbytes() and for loops to do the assignment.
Chuck
On 9/16/07, Ed Kelly wrote:
Hi again to all devs,
Is there any way to use copybytes to take a chunk out of an array? Say, to copy elements 0-10 of an array into another buffer, then concatenate elements 20-30 onto the end of it?
B3st Ed++
Lone Shark "Aviation" out now on http://www.pyramidtransmissions.com http://www.myspace.com/sharktracks
Yahoo! Answers - Get better answers from someone who knows. Try it now. _______________________________________________ PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Lone Shark "Aviation" out now on http://www.pyramidtransmissions.com http://www.myspace.com/sharktracks
--------------------------------- Try Yahoo! Mail now with Unlimited Storage and see the difference.