Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert text file
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00099378
Message ID:
00099430
Views:
21
Which is, in the end, a lot more work than the low-level IO functions. Why plow through the file twice when you can do it once and disk access is one of the slowest things that we do in VFP.

But yours is perhaps simpler. And one great thing about FoxPro is that there is usually at least two ways to do anything that you want and you pick the one that you feel is best for the current situation.
:}
-cjh
>The ultimate truth is that you built interim table with the same structure as text file and then, if necessary, move data from this table into real table using APPEND,SELECT,REPLACE,etc.
>
>>Mr. Pikman's answer is the quick answer. The truth is that we rarely want to store the fields exactly as they are stored in the ASCII file. So the best way to do this is to use the low level IO functions (i.e. FOPEN(), FCLOSE(), FGETS(), etc.)
>>
>>You would FOPEN() the ASCII file and FGETS() one line at a time, parse out the line and store the fields in memvars, do any calculations and massaging of the data that is necessary and then INSERT the memvars into the fields in the tables) of your design and choice.
>>
>>Check the on-line help for any further details that you might need.
>>
>>>>>How could I convert a text file to Dbf file without using Import Wizard?
>>>>>
>>>>>The text format is defined each field name's length, start byte, and end byte.
>>>>>
>>>>>Ex. FieldName Length Start End Byte
>>>>>
>>>>> Field1 1 1 1 1
>>>>> Field2 8 2 9 8
>>>>> Field3 40 10 49 40
>>>>> ....
>>>>>
>>>>>Thanks
>>>>
>>>>I guess you have fixed-length ASCII file and you can prepare table structure and use APPEND FROM ... TYPE SDF.
>>>
>>>Do I need to create a table with the same structure as the fixed-length ASCII file before I do the append file command?
>>>Could you list a bit more details?
>>>
>>>Thanks
-cjh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform