Wc -Sx- Jones wrote: > > John W. Krahn wrote: > > Wc -Sx- Jones wrote: > > > >>James Edward Gray II wrote: > >> > >>>>>> if (-s $output_file) { > > > > Why are you attributing to James what Guruguhan wrote? > > :) > > I'm not -- however that statement was promoted into the > portion of the thread that James asked about (which I was > replying) so James can take ownership of those parts of > this thread.
Not under most country's copyright laws he can't. :-( > >>There are other reasons to test for a file size prior to opening it :) > >> > >>Why open a data file if it is zero length when you expect data? > > > > > > What if "-s $output_file" returns true and then another process > > truncates the file before you open it? > > > > What if "-s $output_file" returns false and then another process adds > > data to the file which you didn't open? > > > > If you read back in this thread I stated that the OP needed to > use a file lock -- shared read w/o write access -- so that the > tests could be accomplished BEFORE another application thread > destroyed the file. > > If the data file was expected to have data at the time I was > planning on opening it and there was no data - an error is > logged -- I care not about what happened after the event in > question -- the file is allowed to expand and fill the entire > Universe when I release the RO lock. > > At any rate we all program differently. :) Locking or opening or stating the file do not guarantee that the file contains data. The only guarantee is if read or readline return actual data to your program. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>