Jochen wrote:
> Joe typed:
>
>> Then you must be talking about some thing else Jo. I don't why it
>> doing it, Your right. When you rewrite a file. It's blank, Theres
>> nothing in there, How ever. Every time I do add a record to it. The
>> new recordnum IS 0. and always 0.
>
> program bintest;
>
> type
> tAdr = record
> name: string[30];
> age: integer;
> end;
>
> var
> a: tAdr;
> f: file of tAdr;
>
> begin
> {no error handling}
> {1. create database }
>
> assign(f, 'bintest.dat');
> rewrite(f);
>
> a.name := 'Smith';
> a.age := 40;
> write(f, a);
> a.name := 'Brown';
> a.age := 50;
> write(f, a);
>
> close(f);
>
> {2. reopen database and read in it}
> reset(f); {depending on filemode reset can open file in read/write mode
> too }
>
> writeln('filesize: ', filesize(f));
> writeln('filepos: ', filepos(f));
> read(f, a);
> writeln(a.name);
> writeln(a.age);
>
> writeln('filesize: ', filesize(f));
> writeln('filepos: ', filepos(f));
> read(f, a);
> writeln(a.name);
> writeln(a.age);
>
> writeln('filesize: ', filesize(f));
> writeln('filepos: ', filepos(f));
>
> seek(f, 0); {jump back to 1.(!) element}
>
> writeln('filesize: ', filesize(f));
> writeln('filepos: ', filepos(f));
> read(f, a);
> writeln(a.name);
> writeln(a.age);
>
> close(f);
> readln;
>
> end.
>
>> And I don't have the doc's for Vpascal any way. I wish I didn't. Been
>> looking for them and I haven't fount them yet
>
> quite useless then. i used FP. but that code should compile without
> changes in VP too.
>
> .. i installed latest version of VP too. code works fine.
> and some do***entation and the integrated help also works at once.
>
> just type in word in the editor e.g. and press ctrl-f1: voila there his
> help on that topic.
>
> greeetz
> jo
>
Jo, Thank You. Your sample. Gave me the idea I was using filesize when I
should have been using filepos. Filepos returns the first record number
= 1. If no records are fount then it returns 0. Thank You. That works


|