fclose (msvcrt)
Last changed: coleharrisjohnson@gmail.com-72.219.133.104

.
Summary
closes a file handle.

C# Signature:

[DllImport("msvcrt.dll", SetLastError=true)]
static extern Int32 fclose(IntPtr file);

VB Signature:

Declare Function fclose Lib "msvcrt.dll" (IntPtr file) As Int32

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

I could not get the above signature to work, so I altered them slightly and this seems to work better:

[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]

static extern IntPtr fopen(String filename, String mode);

[DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]

static extern Int32 fclose(IntPtr file);

Sample Code:

Please add some!

Alternative Managed API:

System.IO.FileStream

Documentation
fclose on MSDN