Delphi 7 XP embedded
Hi,
I am trying to save a file to two separate USB sticks. This file saving takes place frequently and is causing some difficulty. Sometimes the files are not saved and I suspect that the USB system is being overwhelmed. Unfortunately, this works fine on my machine, but the target machine (XP embedded using EWF) shows intermittent behaviour.
The files are saved withe date and time in the name and are also write protected after they are saved.
Is there a faster way? I dont really want to leave file systems open in case of power failure.
The routine is roughly as follows:
Procedure storetoUSB;
var s:string;
f:Tfilestream;
begin // save data from last episode
s:='PN'+inttostr(database[
216])+'_';
// add process number from database
s:=USBA+':'+s+'IMS'+format
datetime('
yymmdd_hhm
m',now)+'.
csv';
f:=tfilestream.create(s,fm
create);
try
IMSlist.savetostream(f);
FlushFileBuffers(f.handle)
;
finally
freeandnil(f);
end;
if filesetattr(s,SysUtils.faR
eadOnly)>0
then ; // set readonly
if (USBB<>#0) and (isdriveready(USBB)=true) then // CVdatastick present
begin
s:='PN'+inttostr(database[
216])+'_';
// add process number to IMS
s:=USBB+':'+s+'IMS'+format
datetime('
yymmdd_hhm
m',now)+'.
csv';
f:=tfilestream.create(s,fm
create);
try
IMSlist.savetostream(f);
FlushFileBuffers(f.handle)
;
finally
freeandnil(f);
end;
if filesetattr(s,SysUtils.faR
eadOnly)>0
then ; // set readonly
end;
end;
Start Free Trial