FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Memoline long lines
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Memoline long lines
Posted: Mon Feb 14, 2022 11:32 AM

Dear friends, how can I read long lines (ie. more than 254 characters long) using Memoline() with Harbour? xHarbour's Memoline() already supports long lines but the Harbour's one not.

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Memoline long lines
Posted: Mon Feb 14, 2022 04:32 PM

Dear Enrico,

MemoLine() is extremelly slow.

Better use this technique:
local aLines := hb_ATokens( MemoRead( "test.txt" ), CRLF )

lines length will not be an issue then

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Memoline long lines
Posted: Mon Feb 14, 2022 07:44 PM

Thank you, I'll think about it for future projects. For existing ones I need Memoline(). It is very fast if used in the proper way.

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Memoline long lines
Posted: Tue Feb 15, 2022 08:48 AM

I changed one of my project so that it is using hb_atokens now and it works very well, thank you!

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Memoline long lines
Posted: Thu Sep 22, 2022 09:46 AM

I'm still searching for a solution. Any ideas? I need to read long lines (more than 254 characters) using MemoLine() with Harbour.

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Memoline long lines
Posted: Thu Sep 22, 2022 09:53 AM

Never mind! I just discovered that Harbour memo functions implicitly support long lines! Great! :-)

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Memoline long lines
Posted: Thu Sep 22, 2022 04:52 PM
Code (fw): Select all Collapse
// IMPRIMINDO UM TEXTO COM A PRINTER.PRG
// Em: 22/09/2022 - Covid-19 - Joao Santos - <!-- e --><a href="mailto:kapiabafhw@gmail.com">kapiabafhw@gmail.com</a><!-- e -->

#include "FiveWin.ch"

FUNCTION Main()

   LOCAL cImptxt, cTexto, oPrn, oFont, nLin, nLinha

   cImpTxt := MemoRead( "ARQ.txt" )  // Pega o texto

   cTexto := ALLTRIM( cImpTxt )

   PRINTER oPrn NAME "Imprimindo um TXT" PREVIEW MODAL

   DEFINE FONT oFont NAME "COURIER NEW" SIZE 0, - 8 OF oPrn

   oPrn:SetPage( 9 )    // A4
   oPrn:SetPortrait()   // Vertical

   PAGE

      nLin := 1

      FOR nLinha = 1 TO MLCOUNT( cTexto, 100 )

         SYSREFRESH()

         oPrn:CmSay( nLin := nLin + .4, 1.5, MEMOLINE( cTexto, 100, nLinha ), oFont )

         IF nLin > 25

            nLin := 1

            ENDPAGE

            PAGE

         ENDIF

      NEXT

      ENDPAGE

   ENDPRINT

   oFont:End()

RETURN NIL

// FIM


Rwegards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion