Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: Answer: How do I pre-extend a file to a specified size

by chipmunk (Parson)
on Jan 05, 2001 at 07:11 UTC ( [id://49986]=note: print w/replies, xml ) Need Help??


in reply to Re: Answer: How do I pre-extend a file to a specified size
in thread How do I pre-extend a file to a specified size

It is rather frustrating that the Q&A section is not properly threaded. I pointed out the bug in merlyn's code in Re: Answer: How do I pre-extend a file to a specified size, but looking at the node for the question, there's no indication that merlyn's answer even has a response. Meanwhile, looking at the node for merlyn's answer, there is no way to get back to the original question.

To fix the bug, swap the second and third arguments to seek:

seek HANDLE, $desired_size -1, 0;

Replies are listed 'Best First'.
Re: Re: Re: Answer: How do I pre-extend a file to a specified size
by DMisener (Initiate) on Jan 05, 2001 at 18:02 UTC
    Thanks... that did the trick (kind-a): Now works fine with Win9x/2K but fails to extend the file on OpenVMS. I'll forward a bug report to the VMS porting people.

      That snippet doesn't check any return values so it is possible that the seek() failed. But I really suspect that VMS creates a sparse file and reports the amount of space the file is using, not the maximum byte offset for the file.

      The same thing often happens under Unix -- the file isn't really preextended as far as allocating that much space on the disk. It is just that "ls" reports the maximum byte offset for the file, not how much disk space has been allocated to it.

              - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-19 03:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found