FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

TEXT

Append a Pascal string to a handle


Maybe you could try to use this FN once you have read the file into your handle
CLEAR LOCAL MODE
LOCAL FN AddStringToHandle(chaine$,theHndl&)
  DIM erreur,state,err
  DIM size&,tempHndl&

  size& = LEN(chaine$)
  tempHndl& = FN NEWHANDLE _clear(size&)
  erreur    = SYSERROR
  LONG IF tempHndl& AND erreur = _noerr
    err = FN HLOCK(tempHndl&)
    BLOCKMOVE @chaine$+1,[tempHndl&],size&
    state  = FN HGETSTATE(theHndl&)
    err    = FN HUNLOCK(theHndl&)
    erreur = FN HANDANDHAND(tempHndl&,theHndl&)
    err    = FN HSETSTATE(theHndl&,state)
  XELSE
    'some error has occured
  END IF
  IF tempHndl& THEN DEF DISPOSEH(tempHndl&)
END FN = erreur
Or using the new syntax for FB^3
LOCAL MODE
DIM err
DIM @ state
LOCAL FN AddStringToHandle(theStr$,theHndl&)   
    '
    LONG IF theHndl&
        state = FN HGETSTATE(theHndl&)              'get the state of our big(?) handle
        CALL HUNLOCK(theHndl&)                      'unlock it. It must be able to move
        err = FN PtrAndHand(@theStr$[1],theHndl&,theStr$[0])
        CALL HSETSTATE(theHndl&,state)
    END IF
    '
END FN = err
then call it like this:
str$ = chr$(13)               'to add a carriage return
err = FN AddStringToHanlde(str$,yourTextHandle&)
Alain