Live data from Hacker News

How do I inform Windows that I'm writing a binary file?

devblogs.microsoft.com

71–74 of 74 posts

Re: How do I inform Windows that I'm writing a binary file?

#71

Earlier quoted context omitted.

Which is how you do the fun spinny icons on the command line without having to invoke ncurses!

You can also just use a \r directly without a \n. For example: spin='/-\|' while true; do i=$(( (i+1) % 4 )) printf "\r${spin:$i:1} Working..." sleep 0.1 done

By the way yes, that is a subtle reference to the TOS computer, so it's best read in that voice :-)

Re: How do I inform Windows that I'm writing a binary file?

#72
post #59

Earlier quoted context omitted.

It still shows up in IETF-style textual network protocols, which evolved on non-Unix systems (HTTP, SMTP, etc.)

MTA-STS, a very recent standard (RFC 8461), only allows CRLF as the line terminator (to the chagrin of *nix lovers, and to the fact that a majority of mail systems are being operated on *nix systems)

Peril of writing protocols with an eye to debug them using cheapest terminal you can find on campus and a grad student paid in coffee

Re: How do I inform Windows that I'm writing a binary file?

#74
post #9

Earlier quoted context omitted.

> The Win32 API. E.g. using WriteFile to write files ( https://learn.microsoft.com/en-us/windows/win32/api/fileapi/ ...) 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.

From literally any language. The WriteFile function comes from kernel32.dll shared library, and follows the certain calling convention. You don't need to use this calling convention inside your own binary (and indeed, MinGW and MSYS use SysV ABI for everything except when calling Win32 API), or ask a random C runtime coming from God knows where to do this for you if you write something other than C. In the UNIX world…

mingw-w64 uses Microsoft C ABI except `long double`. However the C++ ABI is derived from Itanium C++ ABI, which results in a mixture.

64-bit Cygwin/MSYS2 uses a modified MS ABI where `long` is 64-bits.

Post reply on HN