0

Heyo all!

I know this sounds like a super ambiguous question, but I think it's relevant. First, let me define some terms.

Binary

In this question, meaning the literal 1s and 0s that the computer itself sees - the on and off of an electrical switch. I understand that there are different ways of representing binary, but here I mean just the ones and zeros. I mean by no means a Linux executable, but from what I understand a Linux executable is indeed a binary file, just when you cat it, you get a different "format" of output. Again, here I mean 01010101.

Bits and bytes and characters

If you see me referring to these, please excuse my unprofessionalism. I understand that a standard ASCII characters is 8 bits, or 1 byte, but that it can maybe sometimes fit in 7 bits. I also understand that a UTF-8 character can range from 8 bits to something like 32 bits, 1 byte to 4 bytes. This is pretty much my understanding of characters. Don't mind me if I use these names interchangeably, and please do understand that this is my limit of understanding when it comes to this area. Furthermore, when I refer to a character as 8 bits, I mean I understand that it can be 32, as well as all of the other cliché arguments stated above.

"computer"

I will refer to the term "computer" in the future. What I really mean is the CPU, in conjunction with everything else that brings and takes output from it. I understand that a computer is maybe millions of parts, I understand that, say, the Power Supply has nothing to do with the data mentioned below, but when I mention "computer", I really mean CPU and co.

The Question

Now that I've gotten that off my chest, I'd like to give my first pass at the question.

Is there an equivalent of stdout in raw binary?

For example, if I change the letter "A" to binary, I'll get 01000001. I assume that when the computer sees this, it sees an "A". There is a whole alphabet of letters, ten numbers and tons more characters that have a binary representation. These are really just a combination of around 8 1s and 0s.

Now, I know that a binary file is really a set of instructions to the "computer". This much was made clear to me when I was 10 years old. What I wonder is, what is the representation of these instructions? If I take 01000001 and convert it, I'll get "A". Well, what is the binary for "stdout"?

EDIT: I think a good way to put it is "what is the combination of 1s and 0s to indicate to the computer to output xxx (e.x., 01000001)."

I'm honestly unsure if I'm making sense or overthinking it. I feel so silly talking about bInArY iS tHe LaNgUaGe FoR cOmPuTeRs... But I can't get this off my mind.

Anyways, anyone that can alleviate the stress from me is welcome to. Thank you very much in advance!

6
  • 3
    I assume that when the computer sees this, it sees an "A". ... remove that assumption from your mind ... the computer sees only 1 and 0 .... a human decided that a certain combination of 0 and 1 would present as an A when transmitted to a binary to text converter, such as a display or a printer – jsotola Sep 18 '20 at 20:00
  • 2
    Do you mean the string "stdout" (011100110111010001100100011011110111010101110100) or the standard output abstraction? – Andy Dalton Sep 18 '20 at 21:43
  • @jsotola I see, that makes sense. But how does the computer decide to output? I think I mean, what is the "instruction" in binary that says, send this as output? – Bobbbay Sep 19 '20 at 1:10
  • @AndyDalton No hah I mean the abstraction – Bobbbay Sep 19 '20 at 1:10
  • 1
    @Bobbay the computer does not decide anything ... it does exactly as it is told ... what kind of output are you talking about? – jsotola Sep 19 '20 at 1:19
1

Binary, hex, ASCII or even UTF16 and EBCDIC, are all representations of state. When you write decimal 65 (binary 01000001) to stdout it's only convention that makes it appear as A. The visual representation is a convenience. Nowhere on a magnetic disk will you find A stored anywhere; you probably won't even find the binary representation as it will be stored in a way that's more optimal for the implementation.

cat /bin/ls > /tmp/myls
chmod a+x /tmp/myls
/tmp/myls

I think you'll agree that /bin/ls is binary, and the cat command above is writing to stdout. The resulting file, /tmp/myls, can function perfectly happily as a replacement for ls. Proof (?) that stdout is indeed binary.

3
  • 1
    Pedantically, I would argue that binary is just as much a representational device as octal, hexadecimal, or ASCII. Even 0 and 1 don't do the business: they can be represented as 0V and 3.1V on a backplane, a pit on a CD, a magnetic domain on a disk, an electromagnetic frequency in an optic fibre, and so on. The necessary and sufficient condition for our chosen field of work to make sense is that every transition and conversion is consistently reversible, such that what you get back has a predictable and consistent correlation with what you put in. All else is interpretation. – Paul_Pedant Sep 18 '20 at 22:48
  • 2
    Yes, sure. But how far down does one go? The point I was trying to make is that it's about representation, and the concept of stdout being binary or not is kind of not the issue. Feel free to have a go yourself :-) – roaima Sep 18 '20 at 22:59
  • Ok, this makes sense in terms of representation. If I make up a rule that 01000001 = b, on all the computers I make, I'll get a B. What I indeed don't understand is what the combination of 1s and 0s is to indicate to output something. – Bobbbay Sep 19 '20 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.