It seems that every time I call spurt
without :append
, it will open and overwrite the file and then close the file automatically. I have been writing thousands of lines to a file in a routine using spurt. Now it seems like a big waste of I/O resources. I guess if I need to write thousands of lines, I should always use "open" to get a file handle instead. Comments?
Yes, use open
to get a file handle, and use print
or say
(or write
for binary data) to append to it.
spurt
is only useful for one-off operations, and meant to relieve you having to write open
, print
and close
for a single logical write operation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With