Jump to content

Talk:Truncate a file: Difference between revisions

(The task is not limited to Unix)
Line 13:
 
:The task is not limited to Unix. It should be possible to truncate a file on most systems that utilize disks and other storage media type devices. [[User:Markhobley|Markhobley]] 17:11, 19 July 2011 (UTC)
 
::Truncating on windows is not a problem, just call <code>SetEndOfFile()</code> or <code>truncate()</code> (NT is actually POSIX.1 compliant). It's the renaming part that's inconvenient (still not a real problem). Another thing, the requirement that the routine should bail out if requested size is larger than original is unrealistic. If it's important that the file must be the requested size, you should extend it; if it's not important, why not just leave it alone and move on? If you really cared, you should have checked its size beforehand anyway. --[[User:Ledrug|Ledrug]] 17:21, 19 July 2011 (UTC)
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.