I am using Eclipse IDE for developing the c programs. Through terminal I can see the file info using file filename .But I need to print only the version number of a binary file through the same code.I think the eclipse IDE keeps the build and debugging versions .How to retrive binary version number from binary files ?.
Thanks .
The "file" utility is a non-trivial implementation, ie., no straight-forward system calls for getting all those information. You have two options:
Get the source code of "file" utility (here) and manipulate it
for your goal
Easier: use popen(), run file command, retrieve the
output and parse it to get the information you want. The command file <filename> | cut -d"," -f3 should directly give you the version of the executable.
An example of using popen() here
Hope this helps.
Related
I have a chrome extension that works with my exe file. I want to deliver just one exe file to my client. I tried converting the zip file into hex, but then I get a string with 25 thousand lines. I don't think that's the right way to do it.
How can I deliver my zip file with my exe?
What you are trying to do is definitely doable, I've seen it being done many times.
If you have MinGW installed, you can use xxd tool that will do the trick for you.
xxd -i your_zip_filename embedded_zip_data.h
Now you simply add #include "embedded_zip_data.h" in your source code and it will be right there in the application data.
I'm currently learning about operating system kernels and how they are built from the source code (I'm using Minix).
I'm trying to figure out where the shell commands (ls for example) get executed. I know where to locate the ls.c file (src/bin/ls) I'm just not sure where it gets called when the user types it in the terminal.
My goal is to 'hijack' the ls command to accomplish a different result without editing the command file itself ls.c (for example, the ls command now shuts down the computer or echos a string out). In order to do that I need to know where the text from the user gets parsed and the ls command gets executed.
I looked around in the source and I believe it's located inside the process manager (src/minix/servers/pm) however, this was as far as I got before I got lost.
I know this is a very specific question but hopefully I get get it solved.
Thanks in advance
You are mixing two different questions together: where is the ls binary, and where is its source code. For the former question, you can use which to determine its absolute path. For example, on my FreeBSD box, which ls outputs /bin/ls. However, ls is a compiled binary file, so it cannot be "hijacked" easily without changing its source code and compiling it again, and that is the later question. You had already determined the correct path to ls: src/bin/ls, so you need to modify ls.c according to your needs and compile it, then optionally install it to your system. I am not quite familiar with Minix build system, but you can always consult the Minix documents to know how to install an updated userspace program.
Is there a way to get Aginity Workbench to write Unix files rather than Windows files (LF only rather than CR\LF)?
"My" developers check their code into SVN on Windows, and then we check it out into a development environment, and it's ... complicated, but doing a tr -d \r on every file on checkout is problematic.
Thanks.
Why don't you use dos2unix utility to get proper file encoding?
Anyway, there is Aginity Support portal by the link below. You can submit your question there:
https://support.aginity.com/hc/en-us/community/topics
In Workbench you can actually recode a text file to convert it from one encoding to another. Tools menu -> File Utilities -> Re-code a text file.
I am a student currently work on real-time video transmission, recently I found ffmpeg command line is very powerful in real-time encoding/decoding.
But what I want to do is move the c program of the encoding/decoding part (corresponding to ffmpeg command line) into our general big c program.
The problem is, I have already found the corresponding c program file in ffmpeg source folder (but actually I am not sure whether it is or not) its in home/ffmpeg sources/ffmpeg/example/decoding_encoding.c.
I opened the file but cannot run it in Codeblocks, it gives the error
undefined reference to 'av_crc'
and a lot of 'undefined reference' error.
Does anybody have any idea how to solve this?
And any other idea of how to trans ffmepg command line to c program?
One cannot simply take a single file from a project and make it run on its own: it has dependencies.
Looking at the 1st result of the google query ffmpeg c you will find the ffmpeg project git repository, its documentation and even coding examples to achieve what you want.
I am looking to write a program that will extract the contents of an RPM file and do some validation checks. I'll be using Qt for the interface so that the program can be run in Windows and Linux.
Are there any suggestions for extracting the contents for an RPM file on Windows? I would prefer a C library, but other suggestions are welcome also.
rpmlib looks like what you are after.