Skip to content

Latest commit

 

History

History
65 lines (47 loc) · 1.99 KB

OpenFile.md

File metadata and controls

65 lines (47 loc) · 1.99 KB

Home

Function name : OpenFile

Group: File Management - Library: kernel32


The OpenFile function creates, opens, reopens, or deletes a file


Code examples:

Setting the date and time that a file was created
Using GetFileSize
Locking and unlocking file of a VFP table
Comparing file times
Using InternetSetFilePointer when resuming interrupted download from the Internet
Retrieving file information for the VFP executable running
Passing data records between VFP applications via the Clipboard
How to set Creation Date/Time for a folder (WinNT)
Using File Mapping for enumerating files opened by Visual FoxPro

Declaration:

HFILE OpenFile(
  LPCSTR lpFileName,        // file name
  LPOFSTRUCT lpReOpenBuff,  // file information
  UINT uStyle               // action and attributes
);  

FoxPro declaration:

DECLARE INTEGER OpenFile IN kernel32;
	STRING   lpFileName,;
	STRING @ lpReOpenBuff,;
	INTEGER  wStyle  

Parameters:

lpFileName [in] Pointer to a null-terminated string that names the file to be opened

lpReOpenBuff [out] Pointer to the OFSTRUCT structure that receives information about the file when it is first opened. The structure can be used in subsequent calls to the OpenFile function to refer to the open file

uStyle [in] Specifies the action to take


Return value:

If the function succeeds, the return value specifies a file handle


Comments:

After being open the file can be closed by CloseHandle. And oh, of course it can be read, written etc.