Jump to content

CreateFile()?


Recommended Posts

No you aren't, _FileCreate() works almost exactly as your method:

;===============================================================================
;
; Description:    Creates or zero's out the length of the file specified.
; Syntax:          _FileCreate( $sFilePath )
; Parameter(s):  $sFilePath - Path and filename of the file to be created
; Requirement(s):   None
; Return Value(s):  On Success - Returns 1
;                  On Failure - Returns 0 and sets:
;                               @error = 1: Error opening specified file
;                               @error = 2: File could not be written to
; Author(s):        Brian Keene <brian_keene at yahoo dot com>
; Note(s):        None
;
;===============================================================================
Func _FileCreate($sFilePath)
;==============================================
; Local Constant/Variable Declaration Section
;==============================================
    Local $hOpenFile
    Local $hWriteFile

    $hOpenFile = FileOpen($sFilePath, 2)

    If $hOpenFile = -1 Then
        SetError(1)
        Return 0
    EndIf

    $hWriteFile = FileWrite($hOpenFile, "")

    If $hWriteFile = -1 Then
        SetError(2)
        Return 0
    EndIf

    FileClose($hOpenFile)
    Return 1
EndFunc  ;==>_FileCreate

It's copied from File.au3.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...