Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21690

CopyMemory doesn't work with destination as Array of Fixed Length Strings?

$
0
0
I have a byte array called mybytearray with the ascii (1 byte per character) characters "ABCD1234" and would like to split it into 2 equal parts of 4 characters each so I have an array of fixed length strings like this
Code:

dim mystrarray() as string*4
redim mystrarray(1)

I then need to copy this so I have declared CopyMemory using "as any" for the source and destination. The following code should make the bytes of the byte array copy into the array of fixed length strings
Code:

copymemory mystrarray(0),mybytearray(0),8
This CRASHES THE PROGRAM THOUGH!!!!

So then I tried
Code:

copymemory byval strptr(mystrarray(0)),mybytearray(0),8
This didn't crash the program, but the destination array is not containing the input data!

So then I tried
Code:

copymemory byval strptr(mystrarray(0)),byval strptr(strconv(mybytearray(),vbunicode)),8
Again THE DESTINATION ARRAY IS NOT RECEIVING THE DATA FROM THE SOURCE!!!!!!!!!

Someone please help me. Thanks, in advance.

Viewing all articles
Browse latest Browse all 21690

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>