.
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
Click to read this page 4/6/2008 7:23:14 AM - anonymous
Click to read this page 4/6/2008 7:23:14 AM - anonymous
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
Click to read this page 4/6/2008 7:23:14 AM - anonymous
Click to read this page 4/6/2008 7:23:14 AM - anonymous