# tagged [binary]

#### How to read file binary in C#?

How to read file binary in C#? I want to make a method that takes any file and reads it as an array of 0s and 1s, i.e. its binary code. I want to save that binary code as a text file. Can you help me?...

#### Convert a binary string representation to a byte array

Convert a binary string representation to a byte array How do you convert a string such as "01110100011001010111001101110100" to a byte array then used File.WriteAllBytes such that the exact binary st...

#### Fast way of counting non-zero bits in positive integer

Fast way of counting non-zero bits in positive integer I need a fast way to count the number of bits in an integer in python. My current solution is but I am wondering if there is any faster way of do...

#### How to convert a string or integer to binary in Ruby?

How to convert a string or integer to binary in Ruby? How do you create integers 0..9 and math operators + - * / in to binary strings. For example: Is there a way to do this with Ruby 1.8.6 without us...

#### How to pad a binary string with zeros?

How to pad a binary string with zeros? Prints: `1111` I want it to print `00001000` Because the data type is of string and not integer I cannot do something like this:

- Modified
- 7 Oct at 02:57

#### How to print binary tree diagram in Java?

How to print binary tree diagram in Java? How can I print a binary tree in Java so that the output is like: My node:

- Modified
- 30 Jun at 00:2

#### How exactly does binary code get converted into letters?

How exactly does binary code get converted into letters? Out of curiosity, how exactly does binary code get converted into letters? I know there are sites that automatically convert binary to words fo...

- Modified
- 26 Jul at 07:12

#### How do you express binary literals in Python?

How do you express binary literals in Python? How do you express an integer as a binary number with Python literals? I was easily able to find the answer for hex: and octal: --- - `int('01010101111',2...

#### Heap data structure

Heap data structure Trying to think of a lower bound to the position of say, the nth largest key in a max-heap. Assuming the heap's laid out in array. The upper bound's min(2^n-2, array size -1) i thi...

- Modified
- 22 Mar at 14:19

#### What is the binary representation of a boolean value in c#

What is the binary representation of a boolean value in c# I know that a boolean value is 1 byte (8 bits long) But I would like to know is what is its binary representation. e.g. decimal => binary 4...

- Modified
- 26 Jul at 14:36

#### Is there a built-in Binary Search Tree in .NET 4.0?

Is there a built-in Binary Search Tree in .NET 4.0? Is there a built-in binary search tree in .NET 4.0, or do I need to build this abstract data type from scratch? # Edit This is about the binary sear...

- Modified
- 20 Jun at 09:12

#### Convert decimal to binary in python

Convert decimal to binary in python Is there any module or function in python I can use to convert a decimal number to its binary equivalent? I am able to convert binary to decimal using int('[binary_...

#### Difference between "Complete binary tree", "strict binary tree","full binary Tree"?

Difference between "Complete binary tree", "strict binary tree","full binary Tree"? I am confused about the terminology of the below trees, I have been studying the Tree, and I am unable to distinguis...

- Modified
- 4 May at 04:58

#### Why does C# generate different EXEs for the same source-code?

Why does C# generate different EXEs for the same source-code? Every time we recompile our C# application we end up with EXEs with different MD5 signatures. We are recompiling on the same machine, minu...

- Modified
- 18 Nov at 22:31

#### How to get the IEEE 754 binary representation of a float in C#

How to get the IEEE 754 binary representation of a float in C# I have some single and double precision floats that I want to write to and read from a byte[]. Is there anything in .Net I can use to con...

- Modified
- 6 Jun at 16:1

#### Bitwise "~" Operator in C#

Bitwise "~" Operator in C# Consider this unit test code: This test passes. However without the byte cast it fails because the "~" operator returns a value of -173. Why is this?

- Modified
- 25 Oct at 12:10

#### Convert from binary data to an image control in ASP.NET

Convert from binary data to an image control in ASP.NET I have binary data of an image in my database, and I want to display it in an image control in ASP.NET. How? If it is impossible, please find an...

- Modified
- 28 Feb at 22:12

#### Convert to binary and keep leading zeros

Convert to binary and keep leading zeros I'm trying to convert an integer to binary using the bin() function in Python. However, it always removes the leading zeros, which I actually need, such that t...

- Modified
- 31 May at 02:19

#### Read and write to binary files in C?

Read and write to binary files in C? Does anyone have an example of code that can write to a binary file. And also code that can read a binary file and output to screen. Looking at examples I can writ...

#### Converting a byte to a binary string in c#

Converting a byte to a binary string in c# In c# I am converting a `byte` to `binary`, the actual answer is `00111111` but the result being given is `111111`. Now I really need to display even the 2 0...

#### Does adding enum values break binary compatibility?

Does adding enum values break binary compatibility? Imagine this enum in a DLL. Does adding enum values break binary compatibility? If I were to change it, would existing EXEs break? I saw [this answe...

- Modified
- 23 May at 12:8

#### Can I use a binary literal in C or C++?

Can I use a binary literal in C or C++? I need to work with a binary number. I tried writing: But it didn't work. I know that I can use a hexadecimal number that has the same value as `00010000`, but ...

#### Binary String to Integer

Binary String to Integer I have a binary string, entered by the user, which I need to convert to an integer. At first, I naively used this simple line: Unfortunately, this throws an exception if the u...

#### Converting SQL Server varBinary data into string C#

Converting SQL Server varBinary data into string C# I need help figuring out how to convert data that comes in from a table column that is set as into a string in order to display it in a label. This ...

- Modified
- 10 Feb at 15:45

#### Can LINQ use binary search when the collection is ordered?

Can LINQ use binary search when the collection is ordered? Can I somehow "instruct" LINQ to use binary search when the collection that I'm trying to search is ordered. I'm using an `ObservableCollecti...

- Modified
- 19 Nov at 20:35