Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy a TXT File into a Array
Message
From
12/05/1999 01:00:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00217175
Message ID:
00217627
Views:
16
>>>Hello
>>>I want to put a ascii file into a array (like the function AFILEREAD in the library Funcky for Clipper ).
>>>Each lines are a element of the array .
>>>
>>>thanks a lot
>>>bye franck
>>
>>#define MAXLINE 65535
>>handle=fopen("myfile.txt")
>>do while !feof(handle)
>>  dimension aLines[iif( type("aLines")="U", ;
>>              1, alen(aLines,1)+1]
>>  aLines[alen(aLines,1)] = fgets(handle,MAXLINE)
>>enddo
>>=fclose(handle)Cetin
>
>Assuming you can live with no more than 8K characters per line:
>
>SET MEMOWIDTH TO 8191
>CREATE CURSOR Temp (Temp M)
>APPEND BLANK
>APPEND MEMO Temp FROM (cTxtFileName)
>LOCAL nNumLines, i
>nNumLines = MEMLINES(Temp.Temp)
>DIMENSION aMyArray[MAX(1,nNumLines)]
>LOCAL i
>FOR i = 1 TO nNumLines
>   aMyArray[i] = MLINE(Temp.Temp,i)
>ENDFOR
>USE IN Temp
Hi Ed,
Just my curiosity and didn't try it at all. In help memowidth is max. 1024. Has it changed in 6.0 or was wrong and works with >1024 ?
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform