Building a Array from Numeric values in Textfile ?

Building a Array from Numeric values in Textfile ?

Postby ukoenig » Tue Oct 23, 2012 7: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 :

Image

Code: Select all  Expand view

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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Building a Array from Numeric values in Textfile ?

Postby ADutheil » Tue Oct 23, 2012 8: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: Select all  Expand view
AAdd( aLines, &( '{ || "' + MemoLine( cText, 3, n ) + '" }' ) )

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

to rebuild the same array.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 63 guests