lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Nov 10, 2020 at 9:47 PM William Ahern
<william@25thandclement.com> wrote:

> Microsoft's documentation for fread says

fread and fwrite (and fopen) are not Windows API. The relevant [1]
Win32 API would be CreateFile(A/W), ReadFile and WriteFile, which
support nothing like "binary" or "text" modes.

The documentation that you cited is of Microsoft's C/C++ compiler,
which is not part of Windows, nor is it required to develop for
Windows [2], even though it is frequently used for that.

Other C implementations that target Windows may well have different conventions.

Cheers,
V.

[1] I am talking about regular application development for Windows,
for which Microsoft officially designates the Win32 API [3].
Technically there is a lower-level "native" API, which is only
partially documented and even then ostensibly only for the purpose of
driver development. The relevant native API would be ZwCreateFile,
ZwReadFile and ZwWriteFile, which are fully documented and again
support nothing like binary/text modes.

[2] I am still talking about user-mode applications. Even for
user-mode development it is not a straight-forward matter to cite
Microsoft's documentation that clearly states that third-party
compilers would work, but the mere existence of Cygwin and MinGW
demonstrates that.

[3] "The Win32 API (also called the Windows API) is the original
platform for native C/C++ Windows applications that require direct
access to Windows and hardware. It provides a first-class development
experience without depending on a managed runtime environment like
.NET and WinRT (for UWP apps for Windows 10). This makes the Win32 API
the platform of choice for applications that need the highest level of
performance and direct access to system hardware."
https://docs.microsoft.com/en-us/windows/win32/desktop-programming