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

2017-03-22 Thread Sandro Cumerlato
Try " char instead of ' (char 39). I never use ' under Windows. Best regards Sandro Cumerlato On 22 Mar 2017 23:47, "James Richters" wrote: > I'm trying to use copyfile and cannot get it to work, anyone have any > ideas? > > I'm using the procedure below.

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

2017-03-22 Thread James Richters
I'm trying to use copyfile and cannot get it to work, anyone have any ideas? I'm using the procedure below. My writeln showing the contents of the variables seems to indicate they are correct. The souce file does exist and is correct, the destination file does not exitst. I get an error 50

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

2017-03-22 Thread Klaus Hartnegg
Am 21.03.2017 um 19:58 schrieb James Richters: Does anyone know of a way to force critical data to be written to a SSD so it's not lost during a power failure? Here is a unix-like sync command for windows: https://technet.microsoft.com/sv-se/sysinternals/bb897438(en-us).aspx

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

2017-03-22 Thread José Mejuto
El 22/03/2017 a las 19:17, James Richters escribió: Copy the file to the hard drive with a temporary name Flush all writes to above file Delete previous backup file Rename the original file to backup file name Rename the new recently copied file to the original name Hello, Your problem seems

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

2017-03-22 Thread James Richters
Thanks for the link and information on atomic writes. It seems like a much better method. My current scheme is to copy everything to a ramdrive upon boot. Here I can do what I want with my files and if the machine crashes, the files I started with on the hard drive have not been affected.

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

2017-03-22 Thread Giuliano Colla
Il 22/03/2017 14:21, Karoly Balogh (Charlie/SGR) ha scritto: Hi, On Wed, 22 Mar 2017, Giuliano Colla wrote: Il 22/03/2017 13:20, James Richters ha scritto: No, it is not only freepascal, but not every program either. A wild guess. The vilain could be the journal logic. Wild indeed. :)

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

2017-03-22 Thread Henry Vermaak
On Wed, Mar 22, 2017 at 01:50:45PM +0100, Karoly Balogh (Charlie/SGR) wrote: > The usual way to work this problem around on Linux systems at least, is to > write a new file, then do an overwriting rename to the old file name. > There rename is an "atomic" operation, which will be either committed

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

2017-03-22 Thread Karoly Balogh (Charlie/SGR)
Hi, On Wed, 22 Mar 2017, Giuliano Colla wrote: > Il 22/03/2017 13:20, James Richters ha scritto: > > No, it is not only freepascal, but not every program either. > > A wild guess. The vilain could be the journal logic. Wild indeed. :) > You might try overwriting the old file instead of

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

2017-03-22 Thread Karoly Balogh (Charlie/SGR)
Hi, On Wed, 22 Mar 2017, Karoly Balogh (Charlie/SGR) wrote: > However, please note that transactional file handling on power loss is a > quite delicate scenario, so you might not be able to solve all the related > problems with this - what happens exactly when you get a power loss during > a

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

2017-03-22 Thread Giuliano Colla
Il 22/03/2017 13:20, James Richters ha scritto: No, it is not only freepascal, but not every program either. A wild guess. The vilain could be the journal logic. The journal tells that the write operation has not been completed at power off, and restores the last valid version of the file,

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

2017-03-22 Thread Karoly Balogh (Charlie/SGR)
Hi, On Wed, 22 Mar 2017, James Richters wrote: > No, it is not only freepascal, but not every program either. I'm no Windows expert, but Windows API seems to have a way do to this directly. CreateFile() API seems to have a flag, which has a value FILE_FLAG_WRITE_THROUGH, which will cause the

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

2017-03-22 Thread James Richters
No, it is not only freepascal, but not every program either. I have just done some quick tests check this. I have not done any real testing to prove whether these are repeatable all the time or not yet. A file saved with notepad ++ is lost Partial email drafts in outlook are saved A file

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

2017-03-22 Thread Santiago A.
El 21/03/2017 a las 15:39, James Richters escribió: > I should note that these systems are all using Samsung SSDs in them, perhaps > there is some SSD weirdness going on? Yes, I think so. SSD is special. The SSD technology like any flash memories have a limited number of rewrites, so there are

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

2017-03-22 Thread Henry Vermaak
On Tue, Mar 21, 2017 at 06:01:17PM -0700, Ralf Quint wrote: > On 3/21/2017 11:58 AM, James Richters wrote: > >I have not tried FlushFileBuffers() yet, so I just tried it now, I am > >getting the same results. > Well, that is expected, as the issue has nothing to do with your program, > it's the