I realised that the open()
function I\'ve been using was an alias to io.open()
and that importing *
from os
would oversha
Database and system application developers usually use open
instead of fopen
as the former provides finer control on when, what and how the memory content should be written to its backing store (i.e., file on disk).
In Unix-like operating system, open
is used to open regular file, socket end-point, device, pipe, etc. A positive file descriptor number is returned for every successful open
function call. It provides a consistent API and framework to check for event notification, etc on a variety of these objects.
However, fopen
is a standard C function and is normally used to open regular file and return a FILE
data structure. fopen
, actually, will call open
eventually. fopen
is good enough for normal usage as developers do not need to worry when to flush or sync memory content to the disk and do not need event notification.