Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: truncate or trunc

by mr_mischief (Monsignor)
on Apr 25, 2008 at 16:37 UTC ( #682870=note: print w/replies, xml ) Need Help??


in reply to truncate or trunc

Does this give the error:
open my $file, '+>', 'testfile' or die "Can't write testfile: $!\n"; print $file 'test!'; seek $file, 0, 0; print <$file> . "\n"; seek $file, 0, 0; truncate $file, 0 or die "Can't truncate testfile: $!\n"; close $file or die "Can't save testfile: $!\n";

If so, what's the error? truncate says that if truncate isn't implemented it's a fatal error, but I'm not sure what OSes that would include.

BTW, it's usually a good idea to show us what you've tried so we can work from that.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://682870]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2023-10-04 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?