Convert binary to char or char to binary - binary

I know we can convert binary to char by any program but I wanna know how to convert that by myself.
For example;
1010111 == W but how I can find that myself?

You can use this table https://www.asciitable.com/.
It doesn't have direct binary to ascii mapping but you can convert binary to base of 10 and lookup

First convert binary to decimal which is 87
then you refer to the ascii table for number 87 which is W

Related

I have to convert an input file of ASCII and non ASCII characters to a binary vector using Fortran 90

Is there any routine available ? I didnĀ“t find any
Thanks
Under the assumption that you want to read a binary file that contains bytes for printable characters like "A"=65 and nonprintable characters like "ESC"=27 something like this might help?
integer(kind=selected_int_kind(1)), dimension(1000) :: vector
open(unit=10,file='data.data', access='stream', form='unformatted')
i=1
read(unit=10, iostat=ios) vector(i)
do while(ios==0)
i=i+1
read(unit=10, iostat=ios) vector(i)
enddo
For simplicity I assumed that the length of the vector is at most 1000. The vector will now contain the decimal representation of the ASCII characters in the input file.

How to Convert (0.ABBA)16 hexadecimal into octal?

How to convert this ,
I m not getting this?
I tried converting that into decimal 10*16^-1 and so on and got this (0.6708068848)10
Now it become really a complex task is there any short method to do so?
I think you're over-complicating it; I find it easiest to first convert it to binary (base-2) and then to octal (base-8).
Binary (bits partitioned into 3's because octal numbers have 3 bits):
0.101_010_111_011_101_000
Octal:
0.527350

What is the difference between binary and ASCII based file comparison?

If I use a file comparison tool like fc in Windows, you can choose between ASCII and binary comparison.
What is the actual difference between these two comparisons? If I compare two ASCII files, don't I want the binary data of the files to be identical?
WARNING: this is 5 year old loose remembrance of knowledge from uni
Binary representation means you compare the binary exactly, and ascii is a comparison of data type. to put it in a simple case the char 'A' is a representation of 01000001, but that is also an 8 bit integer equal to '65', so that means A = 65 in binary. so if you were doing A + A as a string and 65 43 65 (43 is '+' in binary to decimal), in binary they would be equivalent, but in ascii they would not. This is a very loose explanation and i'm sure i missed a lot, but that should sum it up loosely.
In a text file you want ASCII because you write in ascii characters. In say, a program state saved to a file you want binary to get a direct comparison.

How to convert alphabet to binary?

How to convert alphabet to binary? I search on Google and it says that first convert alphabet to its ASCII numeric value and than convert the numeric value to binary. Is there any other way to convert ?
And if that's the only way than is the binary value of "A" and 65 are same?
BECAUSE ASCII vale of 'A'=65 and when converted to binary its 01000001
AND 65 =01000001
That is indeed the way which text is converted to binary.
And to answer your second question, yes it is true that the binary value of A and 65 are the same. If you are wondering how CPU distinguishes between "A" and "65" in that case, you should know that it doesn't. It is up to your operating system and program to distinguish how to treat the data at hand. For instance, say your memory looked like the following starting at 0 on the left and incrementing right:
00000001 00001111 000000001 01100110
This binary data could mean anything, and only has a meaning in the context of whatever program it is in. In a given program, you could have it be read as:
1. An integer, in which case you'll get one number.
2. Character data, in which case you'll output 4 ASCII characters.
In short, binary is read by CPUs, which do not understand the context of anything and simply execute whatever they are given. It is up to your program/OS to specify instructions in order for data to be handled properly.
Thus, converting the alphabet to binary is dependent on the program in which you are doing so, and outside the context of a program/OS converting the alphabet to binary is really the exact same thing as converting a sequence of numbers to binary, as far as a CPU is concerned.
Number 65 in decimal is 0100 0001 in binary and it refers to letter A in binary alphabet table (ASCII) https://www.bin-dec-hex.com/binary-alphabet-the-alphabet-letters-in-binary. The easiest way to convert alphabet to binary is to use some online converter or you can do it manually with binary alphabet table.

How would you convert a decimal into binary?

Other than defining values to decimals such as 2 = 10, does anyone know of a way in scheme to create a procedure that converts a number into binary? Thank you!
Depending upon what you need, there is a built-in procedure (number->string z radix) that will convert a number to a string, allowing you to specify the numeric base. For example, to convert 22 (decimal) to 10 (binary):
huski> (number->string 22 2)
"10110"
Just to be clear, you would specify 2 as the second parameter since binary is base-2.