Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #3266 > unrolled thread
| Started by | nicktekhne@googlemail.com |
|---|---|
| First post | 2012-03-29 03:06 -0700 |
| Last post | 2012-03-30 04:21 -0700 |
| Articles | 2 — 1 participant |
Back to article view | Back to comp.lang.clipper.visual-objects
Convert Byte Array to String nicktekhne@googlemail.com - 2012-03-29 03:06 -0700
Re: Convert Byte Array to String nicktekhne@googlemail.com - 2012-03-30 04:21 -0700
| From | nicktekhne@googlemail.com |
|---|---|
| Date | 2012-03-29 03:06 -0700 |
| Subject | Convert Byte Array to String |
| Message-ID | <27581644.2180.1333015566790.JavaMail.geo-discussion-forums@vbvd13> |
I have to convert a Byte Array returned from an ActiveX control into a string to save into a memo field (it's actually a .DOC format document from a word processor control).
I can do this and it works fine:
LOCAL uValue AS USUAL
LOCAL cResult AS STRING
LOCAL i,dwLen AS DWORD
uValue:=oControl:SaveToMemory(9,FALSE)
cResult:=""
dwLen:=ALEN(uValue)
FOR i:=1 UPTO dwLen
cResult+=CHR(uValue[i])
NEXT
RETURN cResult
I just wonder if it's the fastest method, or whether there's a better way... I want to make this as efficient as possible.
TIA
Nick
[toc] | [next] | [standalone]
| From | nicktekhne@googlemail.com |
|---|---|
| Date | 2012-03-30 04:21 -0700 |
| Message-ID | <14034464.2071.1333106461543.JavaMail.geo-discussion-forums@vbgx21> |
| In reply to | #3266 |
Just for the records.... got this clarified with the help of Carlos Rocha. VO is actually converting the byte array returned from the ActiveX control into a VO array in this situation. You can make it return a string instead by using __OLEClientByteArrayAsString. So the previous code can be replaced by LOCAL cResult AS STRING __OLEClientByteArrayAsString(BAS_ONCE) cResult:=SELF:SaveToMemory(9,FALSE) RETURN cResult I don't know whether it's faster, but it's certainly neater ;-) Nick
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web