Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy a TXT File into a Array
Message
From
12/05/1999 08:21:09
 
 
To
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:
00217737
Views:
15
>>>>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 ?

We had this discussion back a few weeks, Cetin; the maximum now seems to be 8192 bytes/line. I think if you search back through our discussions, I gave some code to demonstrate that the maximum had changed.

>Cetin
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform