Reading text file into DBase? 
Author Message
 Reading text file into DBase?

Hello. I'm using the APPEND FROM (cFileName) SDF command to load a text file
into a database.

The problem is that the text file has carriage return/linefeed characters in
it and whenever these are read, the rest of the text line is ignored.

For example reading in :   "The computer <CR><LF> is located on the Desk"
would only put "The computer" in the database.  I need the
whole record inserted in the database.

Is there anyway I can get Clipper to ignore the CR LF and read the whole
line into the database?

Thanks for any suggestions.



Sun, 25 Mar 2001 03:00:00 GMT  
 Reading text file into DBase?


Quote:
> Hello. I'm using the APPEND FROM (cFileName) SDF command to load a text file
> into a database.

> The problem is that the text file has carriage return/linefeed characters in
> it and whenever these are read, the rest of the text line is ignored.

This is not surprising, as a "text line" is conventionally
delimited with a LF or CR/LF pair.  And a text file is not
necessarily in SDF format...

Quote:
> For example reading in :   "The computer <CR><LF> is located on the Desk"
> would only put "The computer" in the database.  I need the
> whole record inserted in the database.

> Is there anyway I can get Clipper to ignore the CR LF and read the whole
> line into the database?

Consult your manual for the MEMO??? functions (MEMOREAD(),
MEMOEDIT() etc.) - these will do what you want.
--
Pete
        "We have not inherited the earth from our ancestors,
         we have borrowed it from our descendants."


Sun, 25 Mar 2001 03:00:00 GMT  
 Reading text file into DBase?

Quote:
>Hello. I'm using the APPEND FROM (cFileName) SDF command to load a
text file
>into a database.

>The problem is that the text file has carriage return/linefeed
characters in
>it and whenever these are read, the rest of the text line is ignored.

By convention, records in plain text files are terminated by CR/LF.
If you are trying to put together records out of multiple lines in a
text file, the only way you can do it is by using the low level file
functions like FOPEN, FREAD, etc in conjunction with the string
handling functions to parse the lines up into the desired chunks and
then put those together into the desired record.  Once that is done,
it can be written to the .DBF file.

This is possible only if your text files are structured in some
predictable way, either by unvarying field positions, or by unique
delimiters that separate one field from another.

jdm



Sun, 25 Mar 2001 03:00:00 GMT  
 Reading text file into DBase?

Hi,

You could read in the text files using low level file access; reading each
character on at a time.  Check each character to see if it is a CR or LF; using
for example:
  IF cBuffer = Chr(10) for CR
  IF cBuffer = Chr(13) for CR
  Then add each character to an array.

  Tammy

Quote:



> > Hello. I'm using the APPEND FROM (cFileName) SDF command to load a text file
> > into a database.

> > The problem is that the text file has carriage return/linefeed characters in
> > it and whenever these are read, the rest of the text line is ignored.

> This is not surprising, as a "text line" is conventionally
> delimited with a LF or CR/LF pair.  And a text file is not
> necessarily in SDF format...

> > For example reading in :   "The computer <CR><LF> is located on the Desk"
> > would only put "The computer" in the database.  I need the
> > whole record inserted in the database.

> > Is there anyway I can get Clipper to ignore the CR LF and read the whole
> > line into the database?

> Consult your manual for the MEMO??? functions (MEMOREAD(),
> MEMOEDIT() etc.) - these will do what you want.
> --
> Pete
>         "We have not inherited the earth from our ancestors,
>          we have borrowed it from our descendants."

  vcard.vcf
< 1K Download


Tue, 27 Mar 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Unable to read dbf file as dbase file

2. How do I read lines of Text from Text File and add them to Array

3. APL reading dBase files

4. Read from a dBase.IV file

5. Reading DBASE files

6. Reading Dbase files

7. dbase-file/clipper-index read-module

8. TCL proc for reading/writing Xbase (dBase) files?

9. Converting dBase III to dBase IV files ?

10. Reading fortran text files / Parsing ascii files/ Help!!

11. (Newbie) Reading Text Files....

12. Reading data from a text file to store in a collection

 

 
Powered by phpBB® Forum Software