project BLF > class Mail > method FileToMemptr

Description

Convert a file to a memptr.


Parameters


icFileinputcharacterName of the file to be converted.
ilEncodeinputlogicalShould the memptr be encoded using base64 ?
omFileoutputmemptrMemory pointer to the file content.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method Mail.ReadHandler


program code (program1/mail.p)

IF SEARCH(icFile) = ?
THEN DO :
    <M-2 run SetMessage
          (input  #T-3'File not found: $1.':100(17)t-3# (icMessage), 
           input  icFile (icArguments), 
           input  '' (icFieldName), 
           input  '' (icFieldValue), 
           input  'D':U (icType), 
           input  3 (iiSeverity), 
           input  '' (icRowid), 
           input  'BLF-338':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in Mail>
    ASSIGN oiReturnStatus = -3.
    RETURN.
END.

copy-lob from file icFile to vmFile.

IF ilEncode
THEN do :
    <M-1 run FileEncode (input  vmFile (imIn), 
                     input  true (ilLineBreaks), 
                     output omFile (omOut), 
                     output viFcReturnSuper (oiReturnStatus)) in Mail>
    if viFcReturnSuper <> 0
    then oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then return.
end.
ELSE ASSIGN omFile = vmFile.

finally:
    SET-SIZE(vmFile) = 0.
end finally.