why do most file formats define a start of file marker? [closed] - file-format

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
For instance jpeg (JFIF) has a SOI (start of image) marker. One can argue that it can be used to identify the type of file, but I'm looking for more sound reason with supporting examples.

These are often referred to as "signature bytes" and their primary purpose is simply to aide in validating the file. Some file types contain additional signature bytes elsewhere in the file (ie: BMP format), and some contain none at all. The latter kind still generally provide some other means to validate the file using a variety of techniques, such as checksums, stored file size and the like.

Related

What is the most effective way of reading the last line of a frequently updated log file with C? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 months ago.
Improve this question
Preferably without external dependencies other than Windows 10.
Keep track of file offset of previous read
To find the last line, retrieve offset of prior read from memory/auxiliary file/registry and walk to the end looking for the last line. (If this is the first time, walk the entire file.)
When code reads the last line, record its offset in memory, in an auxiliary file or the registry for the next time.

Does comment style affect binary size? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am getting started to the embedded system's world. During this journey I came across to a "different" way to comment functions:
ISR(INT0_vect) { /* Run every time there is a change on button*/
I particularly prefer something like:
// Run every time there is a change on button
ISR(INT0_vect) {
Is it just a "taste thing" or by commenting like that I can "save" some EEPROM space in my ATMEGA168A?
The style of comments is purely an aesthetic concern. Compilers disregard all comments in your code when generating an object file, so how you format comments will have no bearing on EEPROM space.

Edit and change parts in binary file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I need to change a some parts in binary file. For example "00asdd" to some number. I don't have a clue what to do. So the file can be converted from binary to ASCII.
Use an editor that can handle binary files. emacs can usually do that.
You can also write a C program that opens the file in binary mode and modifies it to you liking. Be aware that is you insert or delete bytes from a binary file, you usually corrupt its structure and it no longer functions correctly.

How to redirect the output of a c code to a text file using another c code [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a c code file (let's say A). I wanted to redirect the output of that code to a text file by using another C program (say B). But the thing is I can't touch (edit) the A file. Is there a way to do so by using FILE operations, maybe?
You have two options here:
Probably the easiest, yet least flexible solution would using system function:
system("A.exe <someargs> > filename.txt");
If you want more flexibility, you should look into your platform APIs. On Windows, you can use CreateProcess specifying a handle to which redirect each of the streams (stdin, stdout and stderr).
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499%28v=vs.85%29.aspx

is it possible recover all codes from so(Shared Object) file? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am really curious that it is possible to recover all codes from so(Shared Object) file.
I made libxxx.so with 2 C files and 2 C header files.
And I removed original files except libxxx.so.
Can I remake those original files from this so file?
I want to know is it possible.
Then How? give me some clues.
Thanks.
You can get certain things back such as method names, and number of arguments from those variables, but no, you cannot decompile a binary .so file back to its original source.

Resources