No. The "" is a shell/cmdline convention, and API calls are generally not
shell.
Thank you Marco for the clarification.
Sandro Cumerlato
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
In our previous episode, Sandro Cumerlato said:
> ' delimiters are mandatory within this example because we are writing paths
> as string parameters directly into the source code.
>
> I believe that I should use both ' and " in case of spaces within paths:
>
> CopyFile('"c:\my silly
On 23 Mar 2017 11:34, "James Richters"
wrote:
Thanks for the response, it got me on the right track and I got it working.
Happy to help you!
I originally did try “ instead of ‘ and have the same results. I was using
‘ because of the example here:
<fpc-pascal@lists.freepascal.org>
Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk
Try " char instead of ' (char 39). I never use ' under Windows.
Best regards
Sandro Cumerlato
On 22 Mar 2017 23:47, "James Richters" <ja...@
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.
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
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
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
] On Behalf Of
Karoly Balogh (Charlie/SGR)
Sent: Wednesday, March 22, 2017 9:13 AM
To: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org>
Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk
Hi,
On Wed, 22 Mar 2017, Karoly Balogh (Charlie/SGR) wrote:
>
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. :)
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
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
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
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,
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
c-pascal-boun...@lists.freepascal.org] On Behalf Of
Santiago A.
Sent: Wednesday, March 22, 2017 4:40 AM
To: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org>
Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk
El 21/03/2017 a las 15:39, James Richters escrib
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
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
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 caching of the operating system that is responsible
for the actual
On 21 Mar 2017 18:59, "James Richters"
wrote:
I have not tried FlushFileBuffers() yet, so I just tried it now, I am
getting the same results. I have also tried disabling write caching in
disk management and STILL have the same results. I am now thinking this
On 21/03/17 20:48, Marco van de Voort wrote:
He closes the file. That should sync.
Not necessarily. On Unix there is also a difference between closing a
file and calling fsync() on it. And even then there are sometimes
additional things you may have to do to survive sudden power loss, such
In our previous episode, Henry Vermaak said:
> > Writeln file
> > Writeln file ...
> > Flush file
>
> Have you tried using the FlushFileBuffers() Windows API? Something like
> this:
>
> FlushFileBuffers(TextRec(AFile).Handle);
>
> Add "windows" to the uses clause, obviously.
He closes the
: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of
Henry Vermaak
Sent: Tuesday, March 21, 2017 11:08 AM
To: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org>
Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk
On Tue, Mar 21, 2017 at
On 21/03/17 15:39, James Richters wrote:
If I then power off the test computer (not doing a correct windows shutdown,
this simulates an unattended power failure) when it boots back up, my file
has the correct date and time and the correct length, hovever the contents
of the file is a string of
On Tue, Mar 21, 2017 at 10:39:23AM -0400, James Richters wrote:
> I am still having this issue. I've managed to narrow down what is happening
> some. The problem is my data is not actually being written all the way to
> disk. I now have a repeatable proven method to reproduce the issue. Here
...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of James Richters
Sent: Friday, February 24, 2017 1:53 PM
To: 'FPC-Pascal users discussions' <fpc-pascal@lists.freepascal.org>
Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk
...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Klaus Hartnegg
Sent: Thursday, February 23, 2017 6:33 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk
Am 21.02.2017 um 22:12 schrieb James Richters
Am 22.02.2017 um 21:27 schrieb James Richters:
Here is the procedure that reads the file.
Also you could always try to immediately read the file each time it has
been modified. Append a log entry to some other file, telling that the
pax file was modified and whether it was still correct.
Am 21.02.2017 um 22:12 schrieb James Richters:
Assign(BitFile,'BitSave.pax');
{$I-}
ReWrite(BitFile);
if ioresult <> 0 then
writeln ('error opening pax file');
WriteLn(BitFile,XADJ:1:8);
WriteLn(BitFile,YADJ:1:8);
WriteLn(BitFile,ZADJ:1:8);
WriteLn(BitFile,WADJ:1:8);
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
...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Jonas Maebe
Sent: Wednesday, February 22, 2017 3:47 PM
To: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org>
Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk
On 22/02/17
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
users discussions <fpc-pascal@lists.freepascal.org>
Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk
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, b
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
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
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.
fpc-pascal@lists.freepascal.org>
Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk
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(B
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,
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
James Richters wrote:
> 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, no others.Do I
On Tue, February 21, 2017 22:12, James Richters wrote:
Hello James,
> 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
>
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, no others.Do I need to do something specific
42 matches
Mail list logo