MEMPTR Issue

karikalanr

New Member
Hi All,

The below code does not work properly. Here I am trying to copy abc.zip to xyz.zip. But the output is not proper. Remember I need to use only from memptr variable. It does work only when file is size is less kbs I tested it with 3kb file. If you look at message statement display "i" value which is equal or greater than original source file size. So import works fine only put statement is not working... "PLEASE REMEMBER WE NEED TO USE MEMPTR".

Can you please make it workable?

define stream s .
define stream s1.
define variable m as memptr no-undo.
define variable st as character no-undo.

input stream s from "C:\abc.zip" binary no-convert.
output stream s1 to "D:\xyz.zip" binary no-convert .
/*50,773,040 */
define variable i as integer no-undo.

set-size(m)= 1024.
repeat:
import stream s unformatted m.
put stream s1 unformatted get-bytes(m, 1,1024).
i = i + 1024.
end.
input stream s close.
output stream s1 close.
message i view-as alert-box.

Thanks.
 

Casper

ProgressTalk.com Moderator
Staff member
Sine you didn't state your progress version:

Code:
define variable m as memptr no-undo.
 
COPY-LOB FILE "abc.zip" TO m.
COPY-LOB m TO FILE "xyz.zip".
SET-SIZE(m) = 0.
m = ?.

Casper
 

tamhas

ProgressTalk.com Sponsor
Assuming Casper's solution doesn't work for you, it might help to clarify what "not working" actually means.
 
Top