Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Loading data from text files.....???
Message
From
22/06/1999 10:10:55
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00232388
Message ID:
00232473
Views:
18
Hi Chris ----
>
>The fields are fixed length so the info for field 1 in my table will always be be the first 20 characters of the text, field 2 will be the next 20 & so on...what I really need to do (I think) is somehow extract the first 20 characters so I can allocate them to field 1, the next 20 so I can allocate them to field 2 & so on...at the moment the system wants to dump everything into the first field in my table...

Consider the following:
nFH=FOPEN("ASCIIFile.DAT")
USE mytable
DO WHILE !FEOF(nFH)
   cLine=FGET(nFH,500)
   SELECT mytable
   REPLACE mytable.field1 WITH SUBSTR(cLine,1,20),;
           mytable.field2 WITH SUBSTR(cLine,21,20)  && Repeat as needed.
ENDDO
USE IN mytable
=FCLOSE(nFH)
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform