Modify

Opened 11 years ago

Closed 10 years ago

#2346 closed Feature Request (Completed)

Add native FileSetEnd() based on _WinAPI_SetEndOfFile()

Reported by: Zedna Owned by: Jon
Milestone: 3.3.13.11 Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

In native AutoIt there were added FileSetPos,FileGePos
so the only one missing native file operation is FileSetEnd.

FileSeEnd can be used (together with FileSetPos) to change size of file (truncating or expanding). Example for this is in HelpFile example for _WinAPI_SetEndOfFile()

Set of all file operation UDF/native functions:

_WinAPI_CloseHandle - FileClose
_WinAPI_CreateFile
_WinAPI_FlushFileBuffers - FileFlush
_WinAPI_GetFileSizeEx - FileGetSize
_WinAPI_ReadFile - FileRead
_WinAPI_SetEndOfFile
_WinAPI_SetFilePointer - FileSetPos
_WinAPI_WriteFile - FileWrite

---

Example for change file size by UDF:

#include <WinAPI.au3>

; truncate file size to 12 bytes
$hFile = _WinAPI_CreateFile('test.txt', 2, 4)
_WinAPI_SetFilePointer($hFile, 12)
_WinAPI_SetEndOfFile($hFile)
_WinAPI_CloseHandle($hFile)

Attachments (0)

Change History (4)

comment:1 Changed 11 years ago by Zedna

Note:
FileSetPos,FileGetPos were added in AutoIt version 3.3.1.0 (20th May, 2009)

comment:2 Changed 11 years ago by Zedna

Note2:
_WinAPI_SetFilePointer(), _WinAPI_SetEndOfFile()
were added to standard UDF includes in AutoIt 3.2.13.6 version (30th July, 2008)

Here is my topic about proposition for this:
http://www.autoitscript.com/forum/topic/76829-winapi-setfilepointer-winapi-setendoffile/

comment:3 Changed 10 years ago by Zedna

Just note:
_WinAPI_CreateFile has native oposite function FileOpen
so the only one missing native file operation function is mentioned FileSetEnd()

comment:4 Changed 10 years ago by Jon

  • Milestone set to 3.3.13.11
  • Owner set to Jon
  • Resolution set to Completed
  • Status changed from new to closed

Added by revision [10487] in version: 3.3.13.11

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jon.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.