[futurebasic] Re: [FB] Text Handle + Return

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1999 : Group Archive : Group : All Groups

From: Alain Pastor <apastor@...>
Date: Fri, 10 Sep 1999 10:19:26 +0200

M Fitzgibbons wrote:

> I work with text handle so infrequently I always find it a hassle.
> I have a program where I read in a text file and attach it to a handle
> th& . Problem is that I always want at least 1 Carrage Return at the end
> of the file to satisfy the processing I do on the text. So how do I find
> the end of the handle and add a CHR$(13) to it?
> Martin

Hello Martin,

Maybe you could try to use this FN once you have read the file into your

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)
    'some error has occured
  IF tempHndl& THEN DEF DISPOSEH(tempHndl&)
END FN = erreur

then call it like this:

str$ = chr$(13)
err = FN AddStringToHanlde(str$,yourTextHandle&)