Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
writefile (coredll)
 

coredll is for smart devices, not desktop Windows. Therefore, this information only applies to code using the .NET Compact Framework. To see if information for writefile in other DLLs exists, click on Find References to the right.

.
Summary
TODO - a short description

C# Signature:

[DllImport("coredll")]
static extern Boolean WriteFile(IntPtr fFile, Byte[] lpBuffer, UInt32 nNumberOfBytesToWrite,
        out UInt32 lpNumberOfBytesWritten, IntPtr lpOverlapped);

VB .NET Signature:

Declare Function WriteFile Lib "coredll.dll" (TODO) As TODO

VB Signature:

Public Declare Function WriteFile Lib "coredll" ( _
    ByVal hFile As Long, _
    ByVal lpBuffer As String, _
    ByVal nNumberOfBytesToWrite As Long, _
    lpNumberOfBytesWritten As Long, _
    ByVal lpOverlapped As Long) As Long

User-Defined Types:

Public Const CREATE_ALWAYS = 2
Public Const OPEN_ALWAYS = 4
Public Const GENERIC_READ = &H80000000
Public Const GENERIC_WRITE = &H40000000
Public Const FILE_END As Long = 2

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Private Function WriteString(MyString As String) As Boolean
    Dim lWritten As Long
    Dim flag As Long
    Dim hFile As Long

    If optOverwrite Then
    flag = CREATE_ALWAYS
    Else
    flag = OPEN_ALWAYS
    End If

    hFile = CreateFile(txtFileName.Text, GENERIC_READ + GENERIC_WRITE, _
               0, 0, flag, 0, 0)

    If optAppend.Value Then
    SetFilePointer hFile, 0, 0, FILE_END
    End If

    If hFile <> -1 Then
    WriteFile hFile, MyString, LenB(MyString), lWritten, 0
    CloseHandle hFile
    End If
End Function

Alternative Managed API:

TODO

Documentation
WriteFile on MSDN

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions