KernClose: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
"KernOpen()", "KernClose()", "KernRead()" are functions from KEE32 intended to read text files with settings during a boot time, such as "Protocol.ini" | "KernOpen()", "KernClose()", "KernRead()" are functions from KEE32 intended to read text files with settings during a boot time, such as "Protocol.ini" | ||
---- | |||
;AI Generated | |||
KernClose is a function that is used to close a file or other input/output (I/O) stream. It takes a handle to an open file or stream as a parameter and closes the file or stream. | KernClose is a function that is used to close a file or other input/output (I/O) stream. It takes a handle to an open file or stream as a parameter and closes the file or stream. |
Revision as of 00:05, 29 December 2022
"KernOpen()", "KernClose()", "KernRead()" are functions from KEE32 intended to read text files with settings during a boot time, such as "Protocol.ini"
- AI Generated
KernClose is a function that is used to close a file or other input/output (I/O) stream. It takes a handle to an open file or stream as a parameter and closes the file or stream.
Syntax
Here is the definition of the KernClose function:
unsigned long KernClose( HFILE hFile );
Parameters
The function takes a single parameter:
- hFile
- A handle to an open file or stream that was returned by a function such as KernOpen or KernDup.
Return Value
The KernClose function returns zero on success or an error code if an error occurred.
Sample
Here is an example of how KernClose might be used in a program:
#include <os2.h> int main() { HFILE hFile; ULONG ulAction; // Open a file for reading if (DosOpen("c:\\example.txt", &hFile, &ulAction, 0, FILE_NORMAL, FILE_OPEN, OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, NULL)) { // An error occurred return -1; } // Do something with the file // Close the file if (KernClose(hFile)) { // An error occurred return -1; } return 0; }
In this example, the KernClose function is used to close a file that was previously opened for reading using the DosOpen function. The handle to the open file is passed as a parameter to KernClose, and the function returns zero on success or an error code if an error occurred.