From: "Erwin Ahlers" Subject: Re: Blockread from file. Date: 12 May 1999 00:00:00 GMT Message-ID: <7hbecm$6h4$1@netnews2.ntc.nokia.com> References: <37392710.2A5F65FF@quasar.no> X-Server-Date: 12 May 1999 08:33:26 GMT X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: Nokia Group Newsgroups: comp.lang.pascal.delphi.misc Hello Erik when you set the record size to 1 in the assign function than you can give the numbers of bytes to blockread/blockwrite. SizeOf also gives the number of byte. The parameter of blockread/write is always the number of records, not the number of bytes. The default value for record size in the assign function is something larger than 1. I don't know the exact value. Hope that helps Erwin Erik Ulven wrote in message <37392710.2A5F65FF@quasar.no>... >Hello, > >I know there is a simple solution to my problem, but it has not come to >my head yet. Im storing data in binary files, and i read and write with >BlockRead,BlockWrite. But i had to change the recordsize. (These files >only write one record to a file.) I thought that if I added the new >variables to be stored at the end of the record the data in the file >would be read correctly into the correct variables. After adding >variables i got Read beyond end of file. To avoid this i only read the >file size into to the block. > >fillchar(recVar,SizeOf(recVar),byte(0)); >if FSize BlockRead(FileVar,recVar,Fsize) >else > BlockRead(FileVar,recVar,SizeOf(recVar)); > >How can i get the new variables to be zero, its not zero by now, only >disturbing numbers.. > >Thanks, > >Erik