Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread Santiago A.
El 21/02/2017 a las 22:12, James Richters escribió: > > > > Thanks for any advice on this > My first action would be to guarantee that the file is closed with a try...finally. AssignFile(BitFile,'BitSave.pax'); ReWrite(BitFile); try finally CloseFile(BitFile); end; Second: Do yo

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread Jürgen Hestermann
Am 2017-02-21 um 22:12 schrieb James Richters: > I have a freepascal Windows console application that I recently ported over from DOS Turbo Pascal. I am have a small settings file that I write to disk that keeps getting corrupted. It happens only occasionally, but it’s always this one file,

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread James Richters
Thanks for the advice on things to look at. Here is some more information. First of all, this happens extremely rarely, about once a month or two on a pc here and another there, but it’s odd that it’s always this one file, and it should not be happening at all.I’m using turbo pascal co

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread Peter
On 21/02/17 21:12, James Richters wrote: > My understanding was the Close(file); would save the file all the way to > disk and flush any buffers that were holding it, I would try adding a Flush(File) before the Close, even though that should not really be needed. ___

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread Sven Barth
Am 22.02.2017 13:12 schrieb "Jürgen Hestermann" : > Also, I am not sure whether "Close" is equivalent to "CloseFile" and "Assign" is equivalent to "AssignFile". > I remenber that I had some issues using the old (TP7) notations but I am don't remember the details. They are the same. The ones withou

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread Santiago A.
El 22/02/2017 a las 13:17, James Richters escribió: > The error I get is when trying to open the file to read it. It’s > something like read past end of file, because the corrupted file is > just one long line, once I read that, the second read is past the end > of file. I can do checking to get

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread James Richters
Here is the procedure that reads the file. It is only read once when the program is started, then written to when changes are made. I don’t have a good reason for having a different file variable name in my read procedure than my write procedure, but those are local varaibles to the procedures

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread Jonas Maebe
On 22/02/17 13:17, James Richters wrote: No other programs on the system ever access this file Not even virus scanners? Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread James Richters
I suppose a virus scanner could access it, I didn't think of that. I guess I should have said no other program intentionally access the file. It's just a way for me to store some variables and get them back, it serves no other purpose. -Original Message- From: fpc-pascal-boun...@lis

Re: [fpc-pascal] FreePascal Windows - Force files to write to disk

2017-02-22 Thread Mark Morgan Lloyd
On 22/02/17 21:00, James Richters wrote: I suppose a virus scanner could access it, I didn't think of that. I guess I should have said no other program intentionally access the file. It's just a way for me to store some variables and get them back, it serves no other purpose. A virus scanne