May 6, 2026
CRLF? More like comment rage
How do I inform Windows that I'm writing a binary file?
Windows says, ‘Not my job’—and the comments instantly turned into a nerd fight
TLDR: Windows doesn’t label files as text or binary—it just writes bytes, and any line-fixing happens in your program or its helper library. The comments quickly split between “this is obvious” dunks, nostalgia about old DOS behavior, and a surprisingly heated argument over what should count as part of Windows.
The big reveal in this surprisingly spicy file-saving saga? Windows does not secretly “know” your file is text and it absolutely will not swoop in to fix line breaks for you. As the article explains, once your app hands data to Windows, it’s just raw bytes. If you want those old-school text tweaks—like turning a new line into the two-character version some systems expect—you do it yourself, or you let a helper library do it before Windows ever sees the file. In other words: Windows is the delivery truck, not the copy editor.
And oh, the comment section had thoughts. One of the funniest reactions was the brutally short drive-by from saltyoldman: “fopen(..., ‘wb’) ?”—basically the online equivalent of sliding sunglasses down your nose and ending the conversation in five characters. But others were not letting it stay that simple. lmm jumped in with the spiciest complaint, arguing that saying the C runtime library isn’t really part of Windows feels weird, and suddenly the thread turned into a philosophy debate about what even counts as “Windows” to developers.
Then came the history buffs. Isamu brought the retro lore, explaining that this whole text-vs-binary mess is a fossil from the old DOS days, when programmers wanted Unix-style code examples to “just work.” And because no internet pile-on is complete without a standards nerd cameo, wpollock arrived with RFC receipts, reminding everyone that some text rules are very real—just not because Windows is enforcing them. So yes, it started as a file question and ended as a standards argument with DOS flashbacks. Classic internet.
Key Points
- •Windows itself does not classify files as text or binary; it treats them as raw bytes.
- •Text-mode transformations such as adding carriage returns before linefeeds must be done by the application or a higher-level library.
- •The C runtime can perform text or binary handling through modes such as "w" and "wb".
- •No additional content transformation occurs once data is passed to the Windows WriteFile API.
- •The old MS-DOS ioctl AH=4401h raw-mode flag applies only to character devices, while Win32 uses SetConsoleMode for similar console-related behavior.