binaryfiles

Transform a hex info to binary using linux command

北城余情 提交于 2019-11-27 09:23:05
问题 I have this binary file on my linux system .. udit@udit-Dabba ~ $ cat file.enc Salted__s�bO��<0�F���Jw!���]�:`C�LKȆ�l Using hexdump command I see its information like this .. udit@udit-Dabba ~ $ hexdump -C file.enc 00000000 53 61 6c 74 65 64 5f 5f 1b 73 a1 62 4f 15 be f6 |Salted__.s.bO...| 00000010 3c 30 cc 46 ee 10 13 11 84 bf 4a 77 21 a4 84 99 |<0.F......Jw!...| 00000020 0e 5d ef 11 18 3a 60 43 a0 4c 4b 1e c8 86 e6 6c |.]...:`C.LK....l| 00000030 Now I am given a file on some other system

Add binary distribution to github's download link

我与影子孤独终老i 提交于 2019-11-27 09:00:59
Github has this download link on the repositories. How can I add binary distributions to this list? I cannot find any info on help.github, so a link to some documentation would be helpful. On Dec 11, 2012 "Upload Releases" functionality aka "Downloads" was deprecated. https://github.com/blog/1302-goodbye-uploads Update : On July 2, 2013 GitHub team announced a new "Releases" feature as a replacement for "Downloads" https://github.com/blog/1547-release-your-software There is a new kid in town: https://bintray.com/ * I am not affiliated How to add files to the release Simply follow the "releases

Why is the binary output not equal when compiling again?

余生长醉 提交于 2019-11-27 08:34:20
I'm using a build script to compile several C# projects. The binary output is copied to a result folder, overwriting the previous version of the files, and then added/committed to subversion. I noticed that the binary output of the compilation are different even when there was no change to the source or environment at all. How is this possible? Isn't the binary result supposed to be exactly equal for the same input? I'm not intentionally using any kind of special timestamps anywhere, but does the compiler (Microsoft, the one included in .NET 4.0) possibly add timestamps itself? The reason I'm

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

我的梦境 提交于 2019-11-27 07:13:52
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? janko No, there is no built-in method to do that. But, directly copied from HERE (with two fixes applied to the original code): /** * Knuth-Morris-Pratt Algorithm for Pattern Matching */ class KMPMatch { /** * Finds the first occurrence of the pattern in the text. */ public static int indexOf(byte[] data, byte[]

Write binary file in PHP

蹲街弑〆低调 提交于 2019-11-27 07:07:08
问题 I have wrote a PHP file which will save a JPEG file in the server and part of the code is listed as follow: //create folder if folder not exist if (!is_dir($save_path)){ $old = umask(0); $flag = @mkdir($save_path,0777); umask($old); if(isset($flag)){ $string = 'Folder Create Success!'."\n"; }else{ $string= 'Folder Create Fail!'."\n"; } echo $string; }else{ echo "Folder exist!!!!"; } //write the content to the server $base=$_REQUEST['image']; $binary=base64_decode($base); header('Content-Type:

How to read / write a struct in Binary Files?

故事扮演 提交于 2019-11-27 07:00:32
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 retrieving, assume that I know how the size of the vector, how to I retrieve from the binary file, the struct variable containing the vector of all the stored elements? I am able to store something to the binary file (as I can see the size increasing when writing), but when I am trying to retrieve back the elements, I am getting size of vector to be zero.

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

只谈情不闲聊 提交于 2019-11-27 06:45:24
问题 How do I read a raw byte array from any file, and write that byte array back into a new file? 回答1: (edit: note that the question changed; it didn't mention byte[] initially; see revision 1) Well, File.Copy leaps to mind; but otherwise this sounds like a Stream scenario: using (Stream source = File.OpenRead(inPath)) using (Stream dest = File.Create(outPath)) { byte[] buffer = new byte[2048]; // pick size int bytesRead; while((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0) { dest.Write

How to read a binary file into a vector of unsigned chars

我们两清 提交于 2019-11-27 06:35:40
Lately I've been asked to write a function that reads the binary file into the std::vector<BYTE> where BYTE is an unsigned char . Quite quickly I came with something like this: #include <fstream> #include <vector> typedef unsigned char BYTE; std::vector<BYTE> readFile(const char* filename) { // open the file: std::streampos fileSize; std::ifstream file(filename, std::ios::binary); // get its size: file.seekg(0, std::ios::end); fileSize = file.tellg(); file.seekg(0, std::ios::beg); // read the data: std::vector<BYTE> fileData(fileSize); file.read((char*) &fileData[0], fileSize); return fileData

Reading multiple precision binary files through fread in Matlab

▼魔方 西西 提交于 2019-11-27 06:13:15
问题 I have a huge binary file which has records with multiple precision as {'Double','Double', 'Int32','Int8','Char'}. I have used memmapfile to read in the data but its painfully slow to read in the data. Is there a way to read the whole file through fread? 回答1: You can use the 'skip' option of the FREAD function as well as FSEEK to read the records one "column" at-a-time: %# type and size in byte of the record fields recordType = {'double' 'double' 'int32' 'int8' 'char'}; recordLen = [8 8 4 1 1

Tell git not to merge binary files but to choose

随声附和 提交于 2019-11-27 04:18:00
When the binary files, swfs, jars and flvs are changed locally, and I try to pull in changes, git tries to merge them and reports conflict. And then, I branch to a temporary branch, and commit the local changed binary files, and merge them back after the pull with recursive theirs strategy. -- Too much work. Is there a way to tell git, not to attempt merging binary files and ask me which one of these versions to use. VonC You could set up a merge drive in a .gitattributes file (only for a given subtree, only for some file types) See this question for instance (or this one ). # choose the name