Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Theresa Curnow
  Where is Theresa Curnow?
 Raleigh
 North Carolina - United States
 Theresa Curnow
Subject: RE: Parse data from ascii file to build dbf
Thread ID: 107177 Message ID: 107186 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Saturday, September 16, 2006 3:04:08 AM         
   



> I know this must be so basic but I need to know how to see data in a .txt file so that I can parse out what I need to populate existing tables. I see how you can create an ascii file from a dbf everywhere but can't find anything on how to read from an ascii file in my program. I know how to parse the data out once I can see it - I'm just stuck between where I have the user browse for the .txt file on their machine and my code that search the data for what I need. Its probably so basic it there doesn't need to be anything written about it! lol.
>
> If anyone can point me in the right direction I'd really appreciate it!
>
> Thanks,
> T.
>
> Just saw a similar thread below. Sorry for the duplicate post.
> Thanks guys.


Theresa,

Further to what Barbara gave you, if your text file has strange or difficult formatting, you might need to read through it using FOPEN(), FGETS(), FSEEK() and FCLOSE(). Use FOPEN() to give you an integer "handle" and the use FSEEK() to go to the correct record and FGETS() to read the record into a string variable.

If the file is small, you can simply read the whole file into a string variable with FILETOSTR() and then use ALINES() to look at each record.

Hope this helps.

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

Parse data from ascii file to build dbf Posted by Theresa Curnow @ 9/15/2006 10:35:09 PM
RE: Parse data from ascii file to build dbf Posted by Barbara Peisch @ 9/16/2006 2:36:14 AM
RE: Parse data from ascii file to build dbf Posted by Ken Murphy @ 9/16/2006 3:04:08 AM
RE: Parse data from ascii file to build dbf Posted by Carlos Alloatti @ 9/17/2006 1:57:38 AM
RE: Parse data from ascii file to build dbf Posted by Pete Sass @ 9/20/2006 5:45:55 PM