binaryfiles

C# - How do I read and write a binary file?

How do I read a raw byte array from any file, and write that byte array back into a new file? ...

VB - How do I read and write a binary file?

How do I read a raw byte array from any file... Dim bytes() as Byte ..and then write that byte array back into a new file? I need it as a byte array to do some processing in between. I'm currently using: To read Dim fInfo As New FileInfo(dataPath) Dim numBytes As Long = fInfo.Length Dim fsAs New FileStream(dataPath, FileMode...

What is the byte signature of a password-protected ZIP file?

I've read that ZIP files start with the following bytes: 50 4B 03 04 Reference: http://www.garykessler.net/library/file_sigs.html Question: Is there a certain sequence of bytes that indicate a ZIP file has been password-protected? ...

Convert .class files to binary files?

When compiling a '.java' file it will create a new '.class' file, which is not a pure binary file. To run this file you need an interpreter called 'java'. Is there a way to convert this '.class' file to a binary file? In which you don't need another program to run? F.ex './filename' in Linux. Sorry for my bad english. -Henrik ...

Searching for a sequence of Bytes in a Binary File with Java

I have a sequence of bytes that I have to search for in a set of Binary files using Java. Example: I'm searching for the byte sequence DEADBEEF (in hex) in a Binary file. How would I go about doing this in Java? Is there a built-in method, like String.contains() for Binary files? ...

Is there a BinaryReader in C++ to read data written from a BinaryWriter in C#?

I've written several ints, char[]s and the such to a data file with BinaryWriter in C#. Reading the file back in (in C#) with BinaryReader, I can recreate all of the pieces of the file perfectly. However, attempting to read them back in with C++ yields some scary results. I was using fstream to attempt to read back the data and the ...

RESTful design - how to model entity's attachments

I am trying to model entity's attachments in REST. Let's say a defect entity can have multiple attachments attached to it. Every attachment has a description and some other properties (last modified, file size...) . The attachment itself is a file in any format (jpeg, doc ...) I was wondering how should I model it RESTfully I thought a...

fread terminating mid-read at null values. Also reading in garbage past expected data.

I am reading in pieces of a binary file using a FILE object in C++. Here is the fseek and corresponding fread call: fseek(fp, startLocation, SEEK_SET); fread(data, m_sizeOfData, 1, fp); m_sizeOfData ends up being an integer greater than 400 thousand. This appears that it should read all 400 thousand+ bytes from the binary file into ...

How can I decompile Linux binaries from Windows?

How can I decompile Linux binaries (*.so) from Windows? Thanks. ...

Can I hex edit a file in Visual Studio?

I want to edit a binary file but I don't want to use another tool other than Visual Studio because it's a pain to switch back and forth. Is there perhaps a add-in or some built in functionality that can do that in Visual Studio? ...

How can I interpret a legacy binary data file without documentation?

Data is often stored in program-specific binary files for which there is little or no documentation. A typical example in our field is data that comes from an instrument, but I suspect the problem is general. What methods are there for trying to understand and interpret the data? To set some boundaries. The files are not encrypted and t...

JPG+Zip File Combination Problem with Zip Format

Hopefully you've heard of the neat hack that lets you combine a JPG and a Zip file into a single file and it's a valid (or at least readable) file for both formats. Well, I realized that since JPG lets arbitrary stuff at the end, and ZIP at the beginning, you could stick one more format in there - in the middle. For the purposes of thi...

parsing binary file in C#

I have a binary file. i stored it in byte array. file size can be 20MB or more. then i want to parse or find particular value in the file. i am doing it by 2 ways -> 1. By converting full file in char array. 2. By converting full file in hex string.(i also have hex values) what is best way to parse full file..or should i do in binar...

How to read a binary file and display the output as a float in C?

Hi, I'm trying to read 4-byte numbers stored in a binary file, but I don't seem to be getting the correct output. Here's my code: #include <stdio.h> #include <stdlib.h> int main () { int res; FILE *file; float v; //Open file file = fopen("prj3.dat", "rb"); if (!file) { printf("Unable to open file input.dat\n"); } ...

Extract Strings from Binary Files in VB.Net

I want to scrape string data from some binary text files that contain embedded SQL statements. I don't need any fancy cleanup--just some way to extract the readable text. I'm using vb.net, but a call to an external utility would work too. ...

Close pop up window after binary file is sent to browser

Hi, Is there a way to close a pop up window after the page writes binary data (PDF) to the browswer? Here are the details: Whenever my web appilcation needs to print, it will pass some parameters over to a pop up window, which will display the print options. When the user clicks on the Print button, it will set the src of a iframe t...

Writing files in bit form to a file in C

i am implementing the huffman algorithm in C. i have got the basic functionality down upto the point where the binary codewords are obtained. so for example, abcd will be 100011000 or something similar. now the question is how do you write this code in binary form in the compressed file. i mean if i write it normally each 1 and 0 will be...

C# how to write long type array to binary file

i have a long type array. How to write this array to binary file. Problem is that if i convert it into byte array some values are changed. The array is like- long array = new long[160000]; Give some code snippet. ...

Specifying chars in python

Hey guys, I need a functions that iterates over all the lines in the file. Here's what I have so far: def LineFeed(file): ret = "" for byte in file: ret = ret + str(byte) if str(byte) == '\r': yield ret ret = "" All the lines in the file end with \r (not \n), and I'm reading it in "rb" mode, (I have to ...

query on unix executables

This might be a basic question but i wanted to ask since i am not aware about it. if i have a binary file which was was created on HP-UX and suddenly i take this binary file on linux or let's say in any other platform like AIX or sun solaris and if i want to check about the details of the binary as to in which platform it was developed...