Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005

    Question Unanswered: Manipulate text file in foxpro 2.x /VFP

    Hi, I'm new in foxpro 2.x/VFP and here i have this scenario;

    i hv tranferred a plain text file using append.... type sdf...

    and the content of this text file are:

    region|holder name|NRIC|holder code|country|Type|Branch|
    06|John Doe|909010081213|Ac8766|m'sia|09|ipoh

    once i done imported to dbf, how do i get separated each field? as each field is separated by '|' sign.

    would the substr() function sufficient enough to move each field and store to the temp variable and then append to other dbf?

    or should i create a dbf which have 140 fields each c(1) so that easy to manipulate the fields?

    please advise, thank you


  2. #2
    Join Date
    Dec 2003
    It depends on what version of Foxpro are you using.
    I don't have any VFP versions older than VFP 6, so I can't test 3 or 5. But if you are using VFP 6 or higher you can create a table with all the fields related to your text file, and use this command to directly import the text file:


    If you are using FoxPro 2.x or lower, the DELIMITED WITH CHARACTER clause isn't available.
    You can either have to parse the text file using low-level I/O functions like FOPEN(), FREAD(), FGETS() and so on. Or you can import it into a table, scan through each record, and parse the fields using functions like AT(), SUBSTR(), LEFT(), RIGHT().

    Even more Fox stuff at

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts