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
6
votes
1 answer

How to read in binary data and cast to unsigned char (C++)

I have a raw image file that is saved in binary data (no encoding). I want to read in the file and cast the values to an unsigned char. But I'm not sure how to begin going about doing this. Each file contains 640x480 bytes. Each pixel is 8bits. I've…
c0d3rz
  • 649
  • 3
  • 15
  • 23
6
votes
1 answer

httprequest and binary data in javascript

Still struggling after lots of tries to read the response of a httprequest that is a binary datastream which will represent an jpg image. edit: the whole thing xmlhttp = false; /*@cc_on@*/ /*@if (@_jscript_version >= 5) //…
Gobliins
  • 3,848
  • 16
  • 67
  • 122
5
votes
5 answers

C/C++: is it possible to pass binary data through the console?

I would like to know if it is possible that an utility yields binary data (i.e. graphical images) and outputs them through IO console, while another application, instructed about the nature of those data and informed of the number of the incoming…
P5music
  • 3,197
  • 2
  • 32
  • 81
5
votes
1 answer

MySQL: primary key is a 8-byte string. Is it better to use BIGINT or BINARY(8)?

We need to store many rows in a MySQL (InnoDB) table, all of them having a 8-byte binary string as primary key. I was wondering wether it was best to use the BIGINT column type (which contains 64-bit, thus 8-byte, integers) or BINARY(8), which is…
ItalyPaleAle
  • 7,185
  • 6
  • 42
  • 69
5
votes
1 answer

WCF Serialization UnitTests and This XmlWriter does not support base64 encoded data. What Writer should I use?

I'm writing some unit tests that serialize and deserialize all of our types that might cross the WCF boundary, in order to prove that all properties will make it to the other side. I've hit a bit of a snag with a byte[]…
Amy B
  • 108,202
  • 21
  • 135
  • 185
5
votes
4 answers

Binary Delta Storage

I'm looking for a binary delta storage solution to version large binary files (digital audio workstation files) When working with DAW files, the majority of changes, especially near the end of the mix are very small in comparison to the huge amount…
Colton Phillips
  • 363
  • 1
  • 8
  • 13
5
votes
1 answer

How to convert a binary string into base64 encoded data

I am receiving binary data in a string. I want to encode that into Base64. Is there any class to do that operation (I want an API).
Balamurugan
  • 2,259
  • 8
  • 33
  • 48
5
votes
5 answers

what is binary data?

gcc 4.6.0 What does binary data look like? Is it all 1's and 0's. I was just wondering, as I was talking to another programmer about copying strings and binary data. Normally, I use strcpy/strncpy functions to copy strings and memcpy/memmove to copy…
ant2009
  • 27,094
  • 154
  • 411
  • 609
5
votes
1 answer

Download PDF from binary string in Javascript

Im trying to download a PDF file from binary string, which I receive as a response from an Ajax. I receive the following data (binaryString): %PDF-1.4.... ..... ....content of file .... %% EOF I tried this: var blob=new Blob([binaryString],…
Dr.G
  • 448
  • 6
  • 19
5
votes
4 answers

Getting at C binary data from OCaml

(Ignoring endianness for the sake of argument - this is just a test case/proof of concept - and I would never use strcpy in real code either!) Consider the following trivial C code: #include #include #include /*…
Gaius
  • 2,556
  • 1
  • 24
  • 43
5
votes
2 answers

Is there a way to convert binary data into a data type that will allow ActiveStorage to attach it as an image to my User model

I am hitting an api to get an image that they have stored and use it as the profile pic for our application's users. I'm using Ruby on Rails and ActiveStorage with AWS to attach and store the image. What they send back is this: {"status"=>"shared",…
5
votes
4 answers

Representing 3 Integers Using One Byte?

I have three integers {a, b, c} that range (say) between the following values: a - {1 to 120, in jumps of 1} b - {-100 to 100, in jumps of 5} c - {1 to 10, in jumps of 1} Due to space considerations, I would like to represent these three values…
user3262424
  • 7,223
  • 16
  • 54
  • 84
5
votes
1 answer

Identify the number of elements in a python struct/pack fmt string?

When using the python struct module on can specify a format string that declares how binary data should be interpreted: >>> from struct import * >>> fmt = 'hhl' >>> values = [1,2,3] >>> blob = pack(fmt, values) It is easily possible to calculate…
dantje
  • 1,739
  • 1
  • 13
  • 25
5
votes
1 answer

Python: Similar functionality in struct and array vs ctypes

Python provides the following three modules that deal with C types and how to handle them: struct for C structs array for arrays such as those in C ctypes for C functions, which necessarily entails dealing with C’s type system While ctypes seems…
Socob
  • 1,189
  • 1
  • 12
  • 26
5
votes
2 answers

Transfer binary data (image etc) in a CSV file

I have some binary data to transfer in addition to some other metadata information stored as string, number etc. The binary data I have is image files stored as a blob column in the database, I want to include the blob column in the csv file and…
mcvkr
  • 3,209
  • 6
  • 38
  • 63