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
31
votes
11 answers

How to identify the file content as ASCII or binary

How do you identify the file content as being in ASCII or binary using C++?
san
31
votes
6 answers

How to parse into base64 string the binary image from response?

I want to parse the requested image from my REST API into base64 string. Firstly... I thought, it would be easy, just to use window.btoa() function for this aim. When I try to do it in such part of my application: .done( function( response,…
user2402179
28
votes
5 answers

Reading binary istream byte by byte

I was attempting to read a binary file byte by byte using an ifstream. I've used istream methods like get() before to read entire chunks of a binary file at once without a problem. But my current task lends itself to going byte by byte and relying…
Adrian McCarthy
  • 45,555
  • 16
  • 123
  • 175
27
votes
3 answers

How do I tell TortoiseHg that a file is not binary?

Someone has recently added a PowerShell (.ps1) script to our Mercurial repository. The file is plain text but TortoiseHg seems to think it's binary and displays a message: "File or diffs not displayed: File is binary". How to I tell TortoiseHg that…
Phil Hale
  • 3,453
  • 2
  • 36
  • 50
27
votes
2 answers

are "seekp" & "seekg" interchangeable?

Well I just noticed that by changing the position -in microsoft visual studio- through "seekp" I implicitelly also change the read-position, when handling files. I am wondering however if this is "portable" behaviour? Can I expect the position of…
paul23
  • 8,799
  • 12
  • 66
  • 149
26
votes
4 answers

Git or Subversion for binary files

We need to store binary files (mostly MS Word documents, ranging from a couple of KB to a couple of MB in size) in a version control repository with over 100 "projects". Currently we use Visual Source Safe but there are some problems, the database…
Aleris
  • 7,981
  • 3
  • 36
  • 42
25
votes
4 answers

Reading 32 bit signed ieee 754 floating points from a binary file with python?

I have a binary file which is simple a list of signed 32 bit ieee754 floating point numbers. They are not separated by anything, and simply appear one after another until EOF. How would I read from this file and interpret them correctly as floating…
Razor Storm
  • 12,167
  • 20
  • 88
  • 148
25
votes
2 answers

Is there any way to include binary or text files in a Rust library?

I am trying to create a library and I want to include some binary (or text) files in it that will have data which will be parsed at runtime. My intention is to have control over these files, update them constantly and change the version of the…
Otobo
  • 714
  • 1
  • 7
  • 13
25
votes
7 answers

What exactly causes binary file "gibberish"?

I haven't found an answer to this particular question; perhaps there isn't one. But I've been wondering for a while about it. What exactly causes a binary file to display as "gibberish" when you look at it in a text editor? It's the same thing with…
crystalattice
  • 5,031
  • 12
  • 40
  • 57
25
votes
5 answers

What really is EOF for binary files? Condition? Character?

I have managed this far with the knowledge that EOF is a special character inserted automatically at the end of a text file to indicate its end. But I now feel the need for some more clarification on this. I checked on Google and the Wikipedia page…
Thokchom
  • 1,602
  • 3
  • 17
  • 32
24
votes
7 answers

Fastest way to read every 30th byte of large binary file?

What is the fastest way to read every 30th byte of a large binary file (2-3 GB)? I've read there are performance problems with fseek because of I/O buffers, but I don't want to read 2-3 GB of data into memory before grabbing every 30th byte either.
K_T
  • 591
  • 7
  • 22
22
votes
2 answers

How to read / write a struct in Binary Files?

I am facing a small problem. I have a struct, which has a vector. Note that the vector is dynamic per every iteration. Now, in a particular iteration, how do I store the struct which contains a vector of size n to a binary file? Also, when…
Shankar Raju
  • 4,356
  • 6
  • 33
  • 52
20
votes
4 answers

Unexpected "padding" in a Fortran unformatted file

I don't understand the format of unformatted files in Fortran. For example: open (3,file=filename,form="unformatted",access="sequential") write(3) matrix(i,:) outputs a column of a matrix into a file. I've discovered that it pads the file with 4…
Andrew Spott
  • 3,457
  • 8
  • 33
  • 59
20
votes
3 answers

Which PHP function to use to read a binary file into a string?

Which PHP function to use to read a binary file into a string?
Poonam Bhatt
  • 10,154
  • 16
  • 53
  • 72
20
votes
2 answers

Is there any way to change the SONAME of a binary directly?

My program depends on libcurl.so.3, but in RHEL6 there is no symbolic link libcurl.so.3 ⇾ libcurl.so.4 (my program can run smoothly when I create this link). However, there is symbolic link libcurl.so ⇾ libcurl.so.4. I would like to modify the…
user2721786
  • 234
  • 1
  • 2
  • 7