I`m opening a counter file, reading from it, adding one to the value, writing the new value back to the counter file.
Is this the only way, do I have to open it twice, can the file be opened once for reading and overwriting I tried using + but it just appends rather than overwrites.
Code:
open (ENQID, "<$enq_id_file_name") or &cgierr("error in get_defaults. unable to open unique enquiry file: $enq_id_file_name.\nReason: $!"); if ($db_use_flock) { flock(ENQID, 1); }
$enqid_default = <ENQID> + 1; # Get next ENQID number
open (ENQID, ">$enq_id_file_name") or &cgierr("error in get_defaults. unable to open unique enquiry file: $enq_id_file_name.\nReason: $!");
if ($db_use_flock) { flock(ENQID, 2); }
print ENQID $enqid_default;
close ENQID;
I`m using $enqid_default further down..
thanks.
chmod