Questions tagged [binary-data]

Binary-data is information stored using a two character alphabet (typically written using 0 and 1)

Binary Data is information which is stored using a two character alphabet. For example, the number 42 could be stored as its base-2 representation: 101010.

In modern computers, almost all data is ultimately represented in binary form.

To be useful, the writer and reader of binary data must have a pre-agreed format (e.g. a file consisting of a 32-bit, two's compliment integer followed by three IEEE 754 floating point numbers).

The term is usually used to distinguish data stored in this way against data stored using a textual encoding. For example, the digits of 42 in base-10 (4 and 2) may be represented using ASCII as 00110100 and 00110010. Whether this is considered binary data or not depends on the task at hand; a chat client would consider messages as textual data, but the communication protocol it is built on may consider the same messages as arbitrary binary data.

1585 questions
4
votes
3 answers

Byte to signed int in C

I have a binary value stored in a char in C, I want transform this byte into signed int in C. Currently I have something like this: char a = 0xff; int b = a; printf("value of b: %d\n", b); The result in standard output will be "255", the desired…
xwgou
  • 65
  • 2
  • 5
4
votes
2 answers

Can't save image properly in Redis using the redis gem in Rails

I'm trying to save an image to Redis, which will be fetched and uploaded later in a Resque task to our image server. An ImageHandle class will fetch an image for us. For now, I'm only concerned with getting an image in and out of Redis. class…
Kaleidoscope
  • 3,609
  • 1
  • 26
  • 21
4
votes
1 answer

Linux X86-64 assembly and printf

I am reading some linux assembly manuals and found idea about using printf() function. I need it to output register values for debugging reasons in binary form to terminal, but now I am tried simply to test that function with text. I am stuck,…
ISE
  • 436
  • 2
  • 9
  • 21
4
votes
4 answers

Using BinaryWriter to seek and insert data

Background: I'm fairly new to C# and currently working on a project intended primarily for learning. I am creating a library to work with .PAK files, as used by Quake and Quake II. I can read and extract them fine, as well as writing a blank…
Edward Wymer
  • 43
  • 1
  • 3
4
votes
2 answers

Why are binary files corrupted when zipping them?

I have a service that delivers zipped files over the web. The zip contains executable files for the Windows platform. I'm using the RubyZip library to compress the file but the process corrupts the binary. At my local server we're using the zip…
3
votes
2 answers

Google protocol buffers and use of std::string for arbitrary binary data

Related Question: vector vs string for binary data. My code uses vector for arbitrary binary data. However, a lot of my code has to interface to Google's protocol buffers code. Protocol buffers uses std::string for…
David Schwartz
  • 179,497
  • 17
  • 214
  • 278
3
votes
1 answer

Using BinaryFormatter in a sequential manner in C#

Note: I'm aware about the disadvantages of using BinaryFormatter in large files. But this is a homework for my friend: (.Net Framework 4)I have created a simple Person class which should be serialized and written in a binary file. For…
Kamyar
  • 18,639
  • 9
  • 97
  • 171
3
votes
4 answers

How to pack data in binary format in c++

Say, i have binary protocol, where first 4 bits represent a numeric value which can be less than or equal to 10 (ten in decimal). In C++, the smallest data type available to me is char, which is 8 bits long. So, within my application, i can hold…
Jimm
  • 8,165
  • 16
  • 69
  • 118
3
votes
2 answers

Binary File Deserialization using PtrToStructure in C#

I'm trying to reverse engineer a bunch of legacy binary data at my company, so that I can move it into a more durable format. The application we used to create this data is no longer supported. I have figured out that the I can describe the data in…
3
votes
2 answers

Searching for sequence of bits in an integer in Python

I have two integers, lets call them haystack and needle. I need to check that, if the binary representation of needle occurred in haystack [and OPTIONALLY find the position of the first occurrence] Example haystack =…
WebMaster
  • 3,050
  • 4
  • 25
  • 77
3
votes
1 answer

Restore pack value from hex string

If I have a hex value produced with e.g. my $hex = sprintf "%v02X", $packed_output and the $packed_output is the result of pack over a series of numbers i.e. my $packed_output = pack "L>*", map { $_->[0] << 16 | $_->[1] } @array; is there a way…
Jim
  • 3,845
  • 3
  • 22
  • 47
3
votes
2 answers

Convert a Registry BINARY value into meaningful string

I'm looking for a way or a Vbscript which can convert a registry key's binary value into a sting. For example think this is my key: [HKEY_CURRENT_USER\System\Majid] "FilePath"=hex:50,4f,2b,2a,90,93,e0,11,80,01,44,45,53,54,00,00 It is translated to:…
Inside Man
  • 4,194
  • 12
  • 59
  • 119
3
votes
1 answer

R: Converting multiple binary columns into one factor variable whose factors are binary columns

I was given a horrendous dataset which I am struggling to clean up: 272 (character) variables and 343 observations. It consists of a lot of binary variables that could have been summarized into one variable with multiple factors. So instead of…
Olga
  • 33
  • 2
3
votes
0 answers

UIImage from PNG binary from BLOB SQlite. Binary created from PHP fread. Null issue

I am trying to load png images into UIImage from a SQlite database. The images are stored as binaries in a blob column. I've created the binaries using PHP fread, so I guess my first question is: is this a form of output that objective c will be…
3
votes
4 answers

How to push binary data into std::string?

Im trying to create a binary file in the following way: string buf; ... buf += filename.length(); buf += filename; etc. So first i give the length in binary format, but how do i convert this into a 4 byte char array, or 2 byte etc? basically i want…
Rookie
  • 3,753
  • 5
  • 33
  • 33