slice an 8209 variable 
Author Message
 slice an 8209 variable

Hi List,

Using ASP 2.0 on PWS 4.0

' snip code
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
' end snip

Vartype(RequestBin) returns 8209.
If I had an offset and I wanted to make a smaller variable
that was also 8209,  what to do? Using native VBScript,
I was able to create vartype 8 and 8204, but not 8209.

Why would I want another 8209 variable?
---------------------------------------------------------
Because the stream class,  *ADODB.Stream*, takes an 8209
variable as an argument to the write method.

' snip code
set oStream = createobject("adodb.stream")
Const adTypeBinary = 1
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2
oStream.type = adTypeBinary
oStream.open
oStream.write bValue  ' must be 8209
'end snip

What I tried so far
--------------------------------
'With offsets PosBeg,PosEnd

'Vartype 8:
    ' snip code
    bValue = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
    ' end snip

'Vartype 8204:
    ' snip code
    dim bValue()
    redim bValue(PosEnd -PosBeg)
    dim nI, nJ
    nJ = 0
    for nI = PosBeg to PosEnd
           bValue(nJ) = MidB(RequestBin,nI,1)
           nJ = nJ + 1
    next
    ' end snip

Thanks for any comments,
    Mark Pryor



Sat, 08 Mar 2003 03:00:00 GMT  
 slice an 8209 variable
Create a 2nd work stream object (binary, read/write) and write all of RequestBin into it, reposition
the work stream to the desired offset (Stream.Position is 0-based) and Read the number of bytes you
want back to another script variable and test what the VarType is - it will be 8209.

--
Michael Harris
Microsoft.MVP.Scripting
--

Hi List,

Using ASP 2.0 on PWS 4.0

' snip code
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
' end snip

Vartype(RequestBin) returns 8209.
If I had an offset and I wanted to make a smaller variable
that was also 8209,  what to do? Using native VBScript,
I was able to create vartype 8 and 8204, but not 8209.

Why would I want another 8209 variable?
---------------------------------------------------------
Because the stream class,  *ADODB.Stream*, takes an 8209
variable as an argument to the write method.

' snip code
set oStream = createobject("adodb.stream")
Const adTypeBinary = 1
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2
oStream.type = adTypeBinary
oStream.open
oStream.write bValue  ' must be 8209
'end snip

What I tried so far
--------------------------------
'With offsets PosBeg,PosEnd

'Vartype 8:
    ' snip code
    bValue = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
    ' end snip

'Vartype 8204:
    ' snip code
    dim bValue()
    redim bValue(PosEnd -PosBeg)
    dim nI, nJ
    nJ = 0
    for nI = PosBeg to PosEnd
           bValue(nJ) = MidB(RequestBin,nI,1)
           nJ = nJ + 1
    next
    ' end snip

Thanks for any comments,
    Mark Pryor



Sat, 08 Mar 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with VarType 8209

2. DUN Stats, 8209 array elements

3. slicing images

4. NEWBIE: How to slice a psFile?

5. slice method for a string object

6. How to slice a DSC compliant Postscript file ?

7. Slice of a VBSript array?

8. String object and slice method...

9. Slice and dice big Word document into many ????

10. File slicing

11. WANTED: OS detection for time-slicing

12. Time Slices routines for Win/Dv ???

 

 
Powered by phpBB® Forum Software