Questions tagged [binaryfiles]

A binary file is a computer file which may contain any type of data, encoded in binary form for computer storage and processing purposes.

A binary file is a computer file that is not a text file. It may contain any type of data, encoded in binary form for computer storage and processing purposes.

Many binary file formats contain parts that can be interpreted as text. for example, some computer document files, word file, office files, contain the text of the document but also contain formatting information in binary form.

Source: Wikipedia (Binary file)

2897 questions
19
votes
1 answer

python get unicode string size

I have a binary file. This file contains an UTF-8 string. Moreover, it is guaranteed that this string is just a single word. In python, how can I get number of letters in this string? Let's say, I opened this file and read bytes: bytes =…
Nick
  • 3,205
  • 9
  • 57
  • 108
19
votes
3 answers

.NET 4.0 Memory Mapped Files Performance

I'd like to know if anyone tried new .NET 4.0 Memory Mapped Files features? I know that they are as old as OS but native handling in .NET is new. Has anyone been able to test this and say something about performance? I'm quite interested in access…
michajas
  • 347
  • 1
  • 5
  • 16
18
votes
5 answers

Convert big endian to little endian when reading from a binary file

I've been looking around how to convert big-endian to little-endians. But I didn't find any good that could solve my problem. It seem to be there's many way you can do this conversion. Anyway this following code works ok in a big-endian system. But…
starcorn
  • 8,261
  • 23
  • 83
  • 124
18
votes
10 answers

using bash: write bit representation of integer to file

I have a file with binary data and I need to replace a few bytes in a certain position. I've come up with the following to direct bash to the offset and show me that it found the place I want: dd bs=1 if=file iseek=24 conv=block cbs=2 |…
Max Leske
  • 5,007
  • 6
  • 42
  • 54
18
votes
3 answers

When should pdf files be tracked in a Git repository and when not

I am developing a LateX package (http://www.openlilylib.org/lilyglyphs) which contains a number of small PDF files. Currently there are only a few dozens of them but as the package and its user base grows there will probably hundreds of them (but…
uli_1973
  • 705
  • 1
  • 5
  • 22
18
votes
3 answers

Mysql byte array storage

I have a byte array created in Java. It represents content of some file. I don't know exactly the maximum size of this array. It can be different sizes. I want to store it in mysql. What type should I use in mysql?
user1379574
  • 689
  • 4
  • 11
  • 23
17
votes
2 answers

How to use fread and fwrite functions to read and write Binary files?

Hi in my project I've to read a .bin file which has sensor data in the form of short(16 bit values). I'm doing this using fread function into a buffer, but I feel that the reading-in is not happening correctly. I mean there is no consistence between…
user1190135
  • 215
  • 1
  • 2
  • 7
17
votes
4 answers

How can I create a binary file using Bash?

How can I create a binary file with consequent binary values in Bash? Like: hexdump testfile 0000000 0100 0302 0504 0706 0908 0b0a 0d0c 0f0e 0000010 1110 1312 1514 1716 1918 1b1a 1d1c 1f1e 0000020 2120 2322 2524 2726 2928 2b2a 2d2c 2f2e 0000030…
mustafa
  • 3,605
  • 7
  • 34
  • 56
17
votes
1 answer

writing/reading binary file in Nim

What's the best way to write and read a binary files in Nim? I want to write alternating floats and ints to a binary file and then be able to read the file. To write this binary file in Python I would do something like import struct # list of…
COM
  • 847
  • 9
  • 23
17
votes
2 answers

How to create a symbolic link with short fullpath?

I am editing paths on some binaries short of recompiling them. I want to replace /lib/ld-linux-armhf.so.3, which I cannot create, by a path of same length, that I can create without rooting the phone. It should be something of the same length…
user2987828
  • 1,116
  • 1
  • 10
  • 33
17
votes
7 answers

How to get the width/height of jpeg file without using library?

Firstly I want to say I tried many times to find the answer by using google search, and I found many results but I did not understand, because I don't know the idea of reading a binary file, and convert the value that Obtained to readable…
Lion King
  • 32,851
  • 25
  • 81
  • 143
17
votes
5 answers

How to read little endian integers from file in C++?

Say I have a binary file; it contains positive binary numbers, but written in little endian as 32-bit integers How do I read this file? I have this right now. int main() { FILE * fp; char buffer[4]; int num = 0; …
user1713700
  • 207
  • 1
  • 3
  • 7
16
votes
6 answers

Serializing a class which contains a std::string

I'm not a c++ expert but I've serialized things a couple of times in the past. Unfortunately this time I'm trying to serialize a class which contains an std::string, which I understand is pretty much like serializing a pointer. I can write out the…
iwasinnamuknow
  • 303
  • 1
  • 2
  • 10
16
votes
4 answers

Replace sequence of bytes in binary file

What is the best method to replace sequence of bytes in binary file to the same length of other bytes? The binary files will be pretty large, about 50 mb and should not be loaded at once in memory. Update: I do not know location of bytes which…
Tomas
  • 17,551
  • 43
  • 152
  • 257
16
votes
3 answers

Git find all binary files in history

Sorry if this is a duplicate of previous question, but I couldn't find quite what I'm looking for. I'm in the process of converting a large cvs codeset (20+ repositories with 15 years of history - 10-15 GB size) to git. Much of the size is due to…