FAQ Database Discussion Community


What does the following makefile command do? /no-symbols-control-file

makefile,make,gnu-make,binaryfiles,contiki
I cam across the following command in a makefile: %-nosyms.$(TARGET).elf: %.co $(PROJECT_OBJECTFILES) $(INTERRUPT_OBJECTFILES) contiki-$(TARGET).a $(CC) $(CFLAGS) -o [email protected] $(filter-out %.a,$^) $(filter %.a,$^) $(filter %.a,$^) $(LDFLAGS) Source: Contiki/cpu/arm/stm32f103/Makefile.stm32f103 . Does this command generate no-symbols-control-file? What is the use of a no symbol image file?...

Extracting all data from a .dat file using Binary Access Read (Application Defined error 1004)

vba,extract,binaryfiles
Blockquote have some files in the .dat format,these files contain some valuable information however they can be quite big, trying to open each file in notepad and extracting the information I need is not efficient at all, as it takes notepad a long time to open each file. I have...

Efficiently writing/reading an array of '1' and '-1's to a binary file

c++,binaryfiles
I am a computational-physics graduate student and my research requires me to write a large array storing the values of '1' and '-1' to a binary file(s). Currently I have come up with the following MWE: #include <fstream> #include <sstream> #include <bitset> const int Num = 1024; std::string int_array_to_string(int state[],...

Print binary matches only with sed?

regex,sed,character-encoding,binaryfiles
Let's first have a binary test file: echo -e '\x00\x01\x00\x0a\x00\x0f\x32\x7a\xb0\x00\x00\x01' > test.bin hexdump -C test.bin # 00000000 00 01 00 0a 00 0f 32 7a b0 00 00 01 0a |......2z.....| # 0000000d Now let's see if I can match the bytes' sequence 0x0f 0x32 0x7a with sed: sed -n...

How to download a file through a custom POST request with CasperJS

javascript,encoding,casperjs,binaryfiles
I am writing a crawler and needs to download file generated after a form request using POST. I have successfully used this.download(url,'POST',Params) for regular forms. One of the sites has many fields using the same name, thus preventing me from using the regular download method. After trying a lot of...

How can I exclude source file metadata from output when compiling?

gcc,compilation,metadata,executable,binaryfiles
For example: $ gcc -O3 foobar.c -o foobar $ grep 'foobar\.c' foobar Binary file foobar matches How can I exclude such unnecessary and revealing metadata from the output of gcc and other compilers? It appears regardless of whether the output is an assembly file, object file, or executable....

Reading Binary Data Using Python

python,arrays,numpy,binaryfiles
I am trying to read files containing gridded data that are formatted as flat binary 16-bit signed integer big-endian. I am using struct.unpack(), which I believe is correct as it allows me to specify the data is both signed and big-endian, but I am not sure of it recognizes the...

How can I read a var from a binary file from different parts? (Say, 2 bytes, and another 2 bytes from another place?)

c++,c,binaryfiles
Is it possible to read data from multiple parts of a binary file? For the sake of example, an integer; sizeof(int)=4; I want to read the first n bytes from a place on the file, and the other 4-n bytes from another place; then somehow fit them together to form...

How to write/read binary files that represent objects?

java,binaryfiles
I'm new to Java programming, and I ran into this problem: I'm creating a program that reads a .csv file, converts its lines into objects and then manipulate these objects. Being more specific, the application reads every line giving it an index and also reads certain values from those lines...

Item not being properly indexed in PHP array inside of for loop

php,arrays,for-loop,attachment,binaryfiles
I have a for loop that is pulling attachments from email using PHP's IMAP functions. This works fine for one attachment, but it is unable to pull more than one attachment from a single mail. See code below - for ($i = 0; $i < $count; $i++) { $attachments[$i] =...

How to check the values of a struct from an image/binary file?

c,gcc,binaryfiles
Is there anyway i can look into the values of a structure after compilation? objdump -td gives the function definitions and only the address where the structure is stored. The problem is i am getting a wrong address for one of the threads/functions in a structure when i run a...

Binary file read - write not working

c,pointers,binaryfiles,fwrite,fread
I've been trying to write a binary file with some information in a program but I can't make it work. I write it and try to read it to see if it worked. This is the struct I'm trying to write inside the file: typedef struct{ int puntuacio; int posicio_x;...

Write and read from Binary file in Java [closed]

java,binaryfiles,randomaccessfile
I have a Binary File. What is the best Way to Write and Read from this file in Java using RandomAccessFile. The Information in the file employeeID int field 20 character last name 20 character first_name hire date int Thank you...

How to unpack a struct in Python?

python,file-io,converter,binaryfiles,unpack
I need to unpack a .bin file. The code used to make the file packed the data like so: x = '' x = x + struct.pack('q', random.randint(0, MAX_NUM)) x = x + struct.pack('q', random.randint(0, MAX_NUM)) When I do a f.read(16), where 16 is the size of the data I...

Django 1.7: serve a pdf -file (UnicodeDecodeError)

python,binaryfiles,python-3.4,django-1.7
I'm trying to serve a PDF file with django 1.7, and this is basically the code that "should" work... it certainly works if I change the content_type to 'text' and download a .tex file with it, but when I try it with a binary file, I get "UnicodeDecodeError at /path/to/file/filename.pdf...

Method for reading bytes into an hexdigest string

python,hash,binaryfiles
I'm reading 16 bytes from a binary buffer named raw: md5 = list(struct.unpack('16B', raw.read(16))) This produces the following list: >>> print(md5) >>> [25, 94, 158, 89, 108, 25, 125, 20, 138, 164, 84, 137, 250, 82, 150, 202] I need to build a proper md5 string that I can then...

Split binary file [closed]

java,io,binaryfiles
The split method takes two arguments, name of file to split, and size of each split. Could you check if I'm on the write track? And the pseudocode on what to put in the for loop? import java.io.*; public class SplitFile { public static void main(String[] args) throws IOException {...

Java JPA write object to binary file

java,jpa,binaryfiles
Database (User) ID     Name 1         Ali 2        Abu 3      Ahmad WriteBinaryFile.java EntityManagerFactory emf = Persistence.createEntityManagerFactory("UserPU"); EntityManager em = emf.createEntityManager(); Query query1 = em.createNativeQuery("select * from user",User.class); List<User> list = query1.getResultList(); for(User userList: list){ FileOutputStream fos = new...

Binary access read find specific string

vba,find,binaryfiles
Sub ReadEntireFileAndPlaceOnWorksheet() Dim X As Long, FileNum As Long, TotalFile As String, FileName As String, Result As Variant, Lines() As String FileName = "C:\Users\Mohamed samatar.DSSE-EMEA\Documents\EQVL\Test\WHVP113_140910_TTinsug_TT_299Data_PUoff_WOT-TakeOff_NotKickDown_gearD_FelLambda.dat" FileNum = FreeFile Open FileName For Binary As #FileNum TotalFile = Space(LOF(FileNum)) Get #FileNum, , TotalFile Close #FileNum Lines = Split(TotalFile, vbNewLine) ReDim Result(1...

Reading in a binary file in C, then matching data from the file to what I have read in

c,binaryfiles
So I'm trying to read in a binary file with 4 bytes per chunk, and when doing a hexdump on my file here is the output: 0000000 0022 0000 6261 6463 3030 3030 6261 6463 0000010 3030 3030 6261 6463 3030 3030 6261 6463 * 00000d0 3030 3030 6261 6463...

Writing/Reading strings in binary file-C++

c++,string,binaryfiles
I searched for a similar post but couldn't find something that could help me. I' m trying to first write the integer containing the string length of a String and then write the string in the binary file. However when i read data from the binary file i read integers...

Writing/reading large vectors of data to binary file in c++

c++,vector,binaryfiles
I have a c++ program that computes populations within a given radius by reading gridded population data from an ascii file into a large 8640x3432-element vector of doubles. Reading the ascii data into the vector takes ~30 seconds (looping over each column and each row), while the rest of the...

Reading binary file to a string but the types are mixed

c,file-io,syntax,binaryfiles
I'm trying to read a binary file but when I read its characters it doesn't looks like it's formatted with char type so for example the numbers don't have their ASCII value instead, their actual value but letters does have ASCII value. Why is that? Also, when I create a...

CSV file is opened as binary file in CentOS

csv,centos,binaryfiles,winscp
I have a add.csv file with 5 thousand mobile numbers. add.csv in Windows Server 929000213816 929000228777 929000289851 929000358597 . . . xxxxxxxxxxxx When I transfer this file to CentOS server with WinSCP, it becomes like this: add.csv in CentOS Server <FF><FE>9^@2^@9^@0^@0^@0^@2^@1^@3^@8^@1^@6^@^M^@ ^@9^@2^@9^@0^@0^@0^@2^@2^@8^@7^@7^@7^@^M^@ ^@9^@2^@9^@0^@0^@0^@2^@8^@9^@8^@5^@1^@^M^@ ^@9^@2^@9^@0^@0^@0^@3^@5^@8^@5^@9^@7^@^M^@ . . . ^@x^@x^@x^@x^@x^@x^@x^@x^@x^@x^@x^@x^@^M^@ When I...

Upload a binary file using browser to github?

github,binaryfiles
How do I upload a new binary file to Github? I try to upload some woff fonts, but I cant, because Github allow me only to add a text file, and not how to upload one, even if there is this request that was solved....

How to put content of binary file in a string in c? [closed]

c,binaryfiles
How can I put content of a binary file in a string? I'm using C....

C++: Problems reading input from a binary file

c++,class,binaryfiles
I have a class AccountManagement in AccountManagement.cpp. I have another class called Account in Account.cpp. I have a template that Orders the given data inside the list using OrdereList class, which also has it's own iterator. The AccountManagement class outputs the Accounts list in a binary file as shown below:...

Recursively search directory of binary files for hexadecimal sequence?

shell,zsh,binaryfiles,hexdump,find-util
The current commands I'm using to search some hex values (say 0A 8b 02) involve: find . -type f -not -name "*.png" -exec xxd -p {} \; | grep "0a8b02" || xargs -0 -P 4 Is it possible to improve this given the following goals: search files recursively display the...

Why do I get Segmentation fault (core dumped)?

c,segmentation-fault,binaryfiles,fwrite,fread
I am a C beginner. After going through many tutorials I am not sure why am I getting the segmentation fault. I get this error on both my functions write_new_file and search_by_firstname. I think the problem lies within the argument type PERSON *inrecord in my function write_new_file. I have already...

Remove '^@' line from a file

sed,ascii,binaryfiles,nano
I have a file in which I have a particular line of this type: ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^ ... Actually all the others lines are a list (a matrix) of numbers or *******. The problem is that I can not be able to open this file with normal editors and so I can...

C++: How to save platform independent binary files?

c++,serialization,binaryfiles,platform-independent
I have a 3D-volume, represented as as vector of vector of vector of float, that I want to save to a binary file. (It's a density volume reconstructed from X-ray images that come from a CT scanner.) Now, I could do this in the following way: //iterate through the volume...

FORTRAN unformatted file write by each process

fortran,mpi,binaryfiles
In my parallel program, there was a big matrix. Each process computed and stored a part of it. Then the program wrote the matrix to a file by letting each process wrote its own part of the matrix in the correct order. The output file is in "unformatted" form. But...

Python - Is it recommended to always open file with 'b' mode?

python-2.7,file-io,binaryfiles
So I have this simple python function: def ReadFile(FilePath): with open(FilePath, 'r') as f: FileContent = f.readlines() return FileContent This function is generic and used to open all sort of files. However when the file opened is a binary file, this function does not perform as expected. Changing the open()...

fread from c++ binary file returning wrong value

c++,file-io,binaryfiles,fread,stdio
I am trying to read and write some boolean grids to a file using stdio.h. The user inputs a number nx (from 1 to 10, generally) and the program generates a list of nx by ceil(nx / 2) boolean grids (ceil(nx / 2) is ny). The grids themselves are stored...

How to manage 3rd party binary dependencies? Artifactory?

dependencies,binaryfiles,artifactory,3rd-party,code-management
I have a big cross platform C++ project with lots of compiled 3rd party components (e.g. DLL files) as dependencies. Obviously I don't want to store all these binary dependencies in my source code git repository. How would you manage these dependencies? Would Artifactory be the right tool? If yes,...

C - binary reading, fread is inverting the order

c,binaryfiles
fread(cur, 2, 1, fin) I am sure I will feel stupid when I get an answer to this, but what is happening? cur is a pointer to a code_cur, a short (2 bytes), fin is a stream open for binary reading. If my file is 00101000 01000000 what I get...

Binary File IOException

java,binaryfiles,ioexception
So, I've been have issues with a homework assignment for about three weeks now, and I can't figure out how to fix it. I have to write a program that will search a binary file of numbers of type int and have the program write them from smallest to largest....

Why can't compress many unpack statements into one as the form of unpack(“Lfffffff”,$bytes)?

php,arrays,file,binaryfiles,unpack
<?php //it is unnecessary to get the data file. $handle = fopen('data', 'rb'); fread($handle,"64"); //it is no use to parse the first 64 bytes here. $bytes= fread($handle,"4"); print_r(unpack("L",$bytes)); echo "<br/>"; $bytes= fread($handle,"4"); print_r(unpack("f",$bytes)); echo "<br/>"; $bytes= fread($handle,"4"); print_r(unpack("f",$bytes)); echo "<br/>"; $bytes= fread($handle,"4"); print_r(unpack("f",$bytes)); echo "<br/>"; $bytes= fread($handle,"4"); print_r(unpack("f",$bytes)); echo "<br/>";...

Offset when reading binary file in python

python,binaryfiles
I have an OSM PBF file which I am trying to parse. The format standard states, and reading it in Sublime Text this is confirmed, that the first four bytes are: 0000 000d Why then, if I run a very simple Python program: PBFfile = open(r'MyFilePath.osm.pbf') PBFfile.read(4)[3].encode('hex') does it return...