Board index » delphi » stupid question but please help, saving record data

stupid question but please help, saving record data

I need to save a series or data of a record type (let's say a.name
a.tel)
but when i retrieve what i saved the program tells me "read beyon end of

file", now, this is simple pascal here, no rocket science, i create the
file with rewrite, then write the first (or several) record, then close
the file, when i need to add i open it with appends and read from it
with read, what's wrong then?

any ideas?

thanks! please e-mail the answer too

--
Uri Fridman

urif...@yahoo.com
u...@afek.co.il

"...the further we go, the older we grow,
the more we know, the less we show..."

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGPfreeware 6.0.2i

<encoded_portion_removed>
JHOCBRhTIQCeJJ4e5BaZNb9x3h7gCJ9mo3zmHuQ=
=T+ef
-----END PGP PUBLIC KEY BLOCK-----

 

Re:stupid question but please help, saving record data


Could you post some code?

Alex

--
Author of the free Chatsystem PINO!
Available at http://pino.cjb.net

Re:stupid question but please help, saving record data


need some source. (Not too much).

--
Greg Lorriman
Free handy utils at http://www.lorriman.demon.co.uk

Quote
Uri Fridman <u...@afek.co.il> wrote in message

news:38006709.9CED58B5@afek.co.il...
Quote
> I need to save a series or data of a record type (let's say a.name
> a.tel)
> but when i retrieve what i saved the program tells me "read beyon end of

> file", now, this is simple pascal here, no rocket science, i create the
> file with rewrite, then write the first (or several) record, then close
> the file, when i need to add i open it with appends and read from it
> with read, what's wrong then?

> any ideas?

> thanks! please e-mail the answer too

> --
> Uri Fridman

> urif...@yahoo.com
> u...@afek.co.il

> "...the further we go, the older we grow,
> the more we know, the less we show..."

> -----BEGIN PGP PUBLIC KEY BLOCK-----
> Version: PGPfreeware 6.0.2i

> mQGiBDeEM7cRBADeGMlMN7th44HleilesvoKCfuSjRFsGQZ3voFN40/zoebPjDVn
> +djvxMByMXfYX5DIWyjIVlFxVpEXlh3rxhIr1YkbFNpYWtFs2fqsALxuRU0pYB2Q
> jLkGYnbbafk8FsoA2SDf6g96NBo+ljBLJD5mFK/CEnCmbarSxW0tev/v/QCg/+tu
> MbdMnfvUHqjrl1pMfiuZViUD/1tsT8TL3MZjP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drUkuZiDtkVvAVy/ftRaVnrXAF
> j7+d7LP2CsAdJSGqkiUGy0asZdb1m8mGCstOrFp+/Djb3j6f4dZ+t6N+N7XKHz7A
> xWGp3IARwJFoLDgZOApRPIXAUvKThfAX8/n9dntfvQqCm/Hso6JeCY1LKZe8Hp+W
> 6ZeCXokARgQYEQIABgUCN4QztwAKCRDqFDaa4yXJgoCeAJ9lli1xgxgdxaA0sKAw
> JHOCBRhTIQCeJJ4e5BaZNb9x3h7gCJ9mo3zmHuQ=
> =T+ef
> -----END PGP PUBLIC KEY BLOCK-----

Re:stupid question but please help, saving record data


Try opening the file with reset if you want to read. Open it with append,
sets the file pointer at the end of the file so you can append more data to
it.

HTH

Arjen

Quote
Uri Fridman wrote in message <38006709.9CED5...@afek.co.il>...
>I need to save a series or data of a record type (let's say a.name
>a.tel)
>but when i retrieve what i saved the program tells me "read beyon end of

>file", now, this is simple pascal here, no rocket science, i create the
>file with rewrite, then write the first (or several) record, then close
>the file, when i need to add i open it with appends and read from it
>with read, what's wrong then?

>any ideas?

>thanks! please e-mail the answer too

>--
>Uri Fridman

>urif...@yahoo.com
>u...@afek.co.il

>"...the further we go, the older we grow,
>the more we know, the less we show..."

>-----BEGIN PGP PUBLIC KEY BLOCK-----
>Version: PGPfreeware 6.0.2i

>mQGiBDeEM7cRBADeGMlMN7th44HleilesvoKCfuSjRFsGQZ3voFN40/zoebPjDVn
>+djvxMByMXfYX5DIWyjIVlFxVpEXlh3rxhIr1YkbFNpYWtFs2fqsALxuRU0pYB2Q
>jLkGYnbbafk8FsoA2SDf6g96NBo+ljBLJD5mFK/CEnCmbarSxW0tev/v/QCg/+tu
>MbdMnfvUHqjrl1pMfiuZViUD/1tsT8TL3MZjPK79nmtPiBHKinmIE/iSIZnZiCI3
>ePwDUvdHqoMIqeewtgOEJ0hw+uCXTybC87Z3JqzW5hgsAAbDQlaS4WdZe64YtN7r
>8bKeKWSbSnfVRqS2BJulV57J9SlIyK3+PYvh+AlhHmN4bhn16eI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LKZe8Hp+W
>6ZeCXokARgQYEQIABgUCN4QztwAKCRDqFDaa4yXJgoCeAJ9lli1xgxgdxaA0sKAw
>JHOCBRhTIQCeJJ4e5BaZNb9x3h7gCJ9mo3zmHuQ=
>=T+ef
>-----END PGP PUBLIC KEY BLOCK-----

Re:stupid question but please help, saving record data


Quote
Uri Fridman <u...@afek.co.il> wrote in message

news:38006709.9CED58B5@afek.co.il...

Quote
> I need to save a series or data of a record type (let's say a.name
> a.tel)
> but when i retrieve what i saved the program tells me "read beyon end of

> file", now, this is simple pascal here, no rocket science, i create the
> file with rewrite, then write the first (or several) record, then close
> the file, when i need to add i open it with appends and read from it
> with read, what's wrong then?

If you're opening with append... you may want to seek to the record number
you wish to read ;)

given that 'n' is the record number... and 'F' is the filehandle...

seek(F,n-1);
read(F,recordname);

Other Threads