Board index » delphi » Why Won't ASCII Driver Read Past Character 4099

Why Won't ASCII Driver Read Past Character 4099

I have an application done in D2 using BDE 5.01.  I am importing using a
schema file a fixed-length ASCII text file into a DBGrid via a TTable.  I
then use Batchmove to create Paradox, etc. tables.  The program bombs if I
use an offset and fieldlength that exceeds 4099 characters.  For example the
following schema file will work fine:

[INCOME RESULTS]
  Filetype=FIXED
  Delimiter=
  Separator=
  CharSet=ascii
  Field1=Less Fuel,Char,6,00,4093

If I increase the field length to 7 or the offset to 4094 then the program
give me an access violation if I am working from within the IDE.  If I try
and run the program from outside the IDE I get a "MyProgram has caused an
invalid page fault at KERNEL32.DLL".  If I try and change the TTable to
Active in the IDE I get, "DELPHI32 caused an invalid page fault in module
IDASCI32.DLL at 017f:4e1f1df9" and the IDE shuts down.

The ASCII text file the program is bombing on is 5,680 characters.  The
largest ASCII text file I must use, this time, is around 6,500 characters.

No changes in the BDE seem to make any difference, but maybe I am missing
something.

I have created my own text file with one record that is 4110 characters long
to ensure the data is not corrupted.  It is nothing but spaces until
character 4193.

Are there any updated drivers that I can get that will allow me cure this
problem?  It would seem that in this day and age of the long string that
this should not cause a problem.

I just installed ver 5.1.1 of the BDE although my BDEAdmin.EXE still reflect
ver 5.01.

Help, please!

Ed

 

Re:Why Won't ASCII Driver Read Past Character 4099


The schema that works is:

[INCOME RESULTS]
  Filetype=FIXED
  Delimiter=
  Separator=
  CharSet=ascii
  Field1=Less Fuel,Char,6,00,4092

Quote
"Ed Cuthbert" <cuthb...@ionia-mi.net> wrote in message

news:3a984336$1_2@dnews...
Quote
> I have an application done in D2 using BDE 5.01.  I am importing using a
> schema file a fixed-length ASCII text file into a DBGrid via a TTable.  I
> then use Batchmove to create Paradox, etc. tables.  The program bombs if I
> use an offset and fieldlength that exceeds 4099 characters.  For example
the
> following schema file will work fine:

> [INCOME RESULTS]
>   Filetype=FIXED
>   Delimiter=
>   Separator=
>   CharSet=ascii
>   Field1=Less Fuel,Char,6,00,4093

> If I increase the field length to 7 or the offset to 4094 then the program
> give me an access violation if I am working from within the IDE.  If I try
> and run the program from outside the IDE I get a "MyProgram has caused an
> invalid page fault at KERNEL32.DLL".  If I try and change the TTable to
> Active in the IDE I get, "DELPHI32 caused an invalid page fault in module
> IDASCI32.DLL at 017f:4e1f1df9" and the IDE shuts down.

> The ASCII text file the program is bombing on is 5,680 characters.  The
> largest ASCII text file I must use, this time, is around 6,500 characters.

> No changes in the BDE seem to make any difference, but maybe I am missing
> something.

> I have created my own text file with one record that is 4110 characters
long
> to ensure the data is not corrupted.  It is nothing but spaces until
> character 4193.

> Are there any updated drivers that I can get that will allow me cure this
> problem?  It would seem that in this day and age of the long string that
> this should not cause a problem.

> I just installed ver 5.1.1 of the BDE although my BDEAdmin.EXE still
reflect
> ver 5.01.

> Help, please!

> Ed

Re:Why Won't ASCII Driver Read Past Character 4099


My guess, and it is only a guess, is that you are causing some kind of
buffer overrun in the BDE ASCII driver when you pass 4096 characters. The
only solution I can suggest is to write your own import routine using the
Pascal text file I/O functions.

--
Bill

Re:Why Won't ASCII Driver Read Past Character 4099


Bill,

Thanks for your answer.  Do you know anywhere where I can get information on
the ASCII driver?  I am assuming by your answer that if I start at character
number 4096 I am loading into the buffer all the characters from 1 to 4095.
Is that correct?  Is it possible this is a limitation of the BDE?  If so, is
there anyplace I can get information on the BDE?  I have spent days on the
Borland Support pages and the various other support groups trying to solve
this problem.  I have found lots of information, but nothing on this issue.

The reason I am trying so desperately to solve this issue is the schema
files and program is done.  There are nine schema files with up to 400+
fields in some of them.  I am sure you know what kind of a pain in the
derriere that was.  I tested the first few schema files and made the
incorrect assumption the rest would be fine.  Stupid I know, but
unfortunately, I did it nonetheless.

Thanks again for your help!!!

Ed

Re:Why Won't ASCII Driver Read Past Character 4099


I don't know of any source of information other than the help files. I
suspect that this is a limitation of the BDE ASCII driver and if the cause
is a buffer overrun there is no way around it.

--
Bill

Re:Why Won't ASCII Driver Read Past Character 4099


Bill,

That is not what I wanted to hear, but thanks for all your help.

Ed

"Bill Todd (TeamB)" <billtodd...@nospam.qwest.net> wrote in message
news:3a9acf8c$1_2@dnews...

Quote
> I don't know of any source of information other than the help files. I
> suspect that this is a limitation of the BDE ASCII driver and if the cause
> is a buffer overrun there is no way around it.

> --
> Bill

Re:Why Won't ASCII Driver Read Past Character 4099


Thanks Jeff.  I am on my way there right now.

Ed

"Jeffrey A. Wormsley" <jworms...@debitek.com> wrote in message
news:9055541F5jwormsleyatdebitekdo@207.105.83.62...

Quote
> cuthb...@ionia-mi.net (Ed Cuthbert) wrote in <3a9ad3f5$1_2@dnews>:

> >Bill,

> >That is not what I wanted to hear, but thanks for all your help.

> There is an article on the Gexperts site about creating your own TDataSet
> descendant, along with sample code for doing so with a TCollection and
> Outlook.  You could take that code and create a TTextDataSet from it by
> simply overriding a few methods to allocate the buffers, and handling the
> text file access.  Then your existing code that used the ASCII driver can
> be easily replaced to use your TTextDataSet, and you won't have to rewrite
> the whole thing from scratch.

> HTH,
>  Jeff.

Re:Why Won't ASCII Driver Read Past Character 4099


cuthb...@ionia-mi.net (Ed Cuthbert) wrote in <3a9c7c66_1@dnews>:

Quote
>Thanks Jeff.  I am on my way there right now.

If it works out for you, please let us know (and maybe share?).

I thought about using it to convert an old TP app that used homebrew
BTree's, but I had already ported the BTree code to D2, and forgot I had
done so.

Jeff.

Re:Why Won't ASCII Driver Read Past Character 4099


I gave up on that Jeff.  Sorry!

What I did was use readln/writeln and chop out a lot of spaces in the file.
I was able to get out more than what I needed to come well below the 4,000
character limit.

If you need a copy of that I'll be glad to provide it, but the toughest part
was counting spaces as you can well imagine.

Ed

"Jeffrey A. Wormsley" <jworms...@debitek.com> wrote in message
news:905B62417jwormsleyatdebitekdo@207.105.83.62...

Quote
> cuthb...@ionia-mi.net (Ed Cuthbert) wrote in <3a9c7c66_1@dnews>:

> >Thanks Jeff.  I am on my way there right now.

> If it works out for you, please let us know (and maybe share?).

> I thought about using it to convert an old TP app that used homebrew
> BTree's, but I had already ported the BTree code to D2, and forgot I had
> done so.

> Jeff.

Other Threads