How do I inform Windows that I'm writing a binary file?
devblogs.microsoft.com
How do I inform Windows that I'm writing a binary file?
1–10 of 74 posts
Re: How do I inform Windows that I'm writing a binary file?
#2Re: How do I inform Windows that I'm writing a binary file?
#3fopen(..., "wb") ?
Re: How do I inform Windows that I'm writing a binary file?
#4Re: How do I inform Windows that I'm writing a binary file?
#5The article seems to be taking the position that the C runtime library is not part of "Windows", which feels like a rather odd view to me. What is the stable API that Windows offers to application developers if not that?
It wasn't until fairly recently that the C runtime was stably shipped with Windows. Previously you had to install the correct version of the C library alongside your application.
Re: How do I inform Windows that I'm writing a binary file?
#6fopen(..., "wb") ?
It's C library taking care of the "b" part for you according to the article.
Re: How do I inform Windows that I'm writing a binary file?
#7But in Unix “\n” is a single byte, and in DOS it is 2. So they introduced text and binary modes for files on DOS. Behind the scenes the library will handle the extra byte. This is not necessary in Unix.
I used to have to be careful about importing files to DOS. Did the file come from Unix?
Re: How do I inform Windows that I'm writing a binary file?
#8The article seems to be taking the position that the C runtime library is not part of "Windows", which feels like a rather odd view to me. What is the stable API that Windows offers to application developers if not that?
C runtime library being part of OS is accidental thing in Unix, 16bit and 32bit Windows API even does not use C-compatible ABI (instead, Pascal-compatible one is present)
Re: How do I inform Windows that I'm writing a binary file?
#9The article seems to be taking the position that the C runtime library is not part of "Windows", which feels like a rather odd view to me. What is the stable API that Windows offers to application developers if not that?
The Win32 API. E.g. using WriteFile to write files ( https://learn.microsoft.com/en-us/windows/win32/api/fileapi/... ) It wasn't until fairly recently that the C runtime was stably shipped with Windows. Previously you had to install the correct version of the C library alongside your application.
Which is called from what, if not C? Does windows really offer no API for writing text (rather than bytes) to files? Or does it rely on the application developer to manage line endings in their own code? Neither of those sounds very developer-friendly.
Re: How do I inform Windows that I'm writing a binary file?
#10The article seems to be taking the position that the C runtime library is not part of "Windows", which feels like a rather odd view to me. What is the stable API that Windows offers to application developers if not that?