FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Building a Array from Numeric values in Textfile ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Building a Array from Numeric values in Textfile ?
Posted: Tue Oct 23, 2012 07:28 PM
Hello,

I want to create a Array from numeric values of a Text-file
That makes it possible, to save and restore multiselected records from xBrowse


but getting a error :

Selected Records saved to a Textfile :



Code (fw): Select all Collapse
FUNCTION SAVE_MULTI( oBrw )
LOCAL cArray := "", aSelRec := oBrw:aSelected // xBrowse-array with multiselected records

I := 1
FOR I := 1 TO LEN( aSelRec )
    cArray+= ALLTRIM(STR(aSelRec[I])) + CRLF 
NEXT
MEMOWRIT( "cFile1.txt", cArray )

RETURN NIL

//----- rebuild the multiselected xBrowse-array -------------

FUNCTION READ_MULTI( cText, oBrw )
LOCAL aLines := {}, n

FOR n = 1 to MlCount( cText )
    AAdd( aLines, &( '{ || "' + MemoLine( cText, 3, n ) + '" }' ) )
NEXT

RETURN aLines


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Building a Array from Numeric values in Textfile ?
Posted: Tue Oct 23, 2012 08:17 PM
You might try mlcount() -1 to verify if the eof character is the culprit. Or replace CRLF with hb_osnewline(). Pure guess!
Aparently there is no codeblock in aSelRec := oBrw:aSelected, so why do you add them to aLines?
Code (fw): Select all Collapse
AAdd( aLines, &( '{ || "' + MemoLine( cText, 3, n ) + '" }' ) )

I´d try
Code (fw): Select all Collapse
AAdd( aLines, MemoLine( cText, 3, n ) )

to rebuild the same array.
Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10

Continue the discussion