Hello! I know I must take the efforts of learning C..! I need to recompile a binary with the following at the beginning: test if a file exists, remove it and exit. All in "C". As simple as this in sh:
I think there are a lot of us here who could write that in C in a matter of a few minutes, but you'd not learn anything if any of us did. Thus, I'll offer a few pointers:
look at using argc and argv to get the file name from the command line
Use the stat() function to determine whether the file exists.
Use the unlink() funciton to remove the file if it exists
Use the man command to determine the calling parameters and how they work. Have fun -- C is a wonderful language.
Hi, agama! Don't forsake me this time! I know I need to learn C, but what you said to me is like speaking in greek! I'm wrestling with a broken binary which is called by initramfs, I tried doing a gpkg-divert on the binary and calling it from a shell script. Something like:
Now, the binary is called in the beginning of boot, and it tells: /sbin/binary.debian: not found (while the binary is there...) The script works flawlessly, but fails when called by initramfs.
So I found that I should include this piece of code in the C source, but I don't understand a single piece of code in C and I'm in a big hurry.
I even feel like developing some tools in C (which is IMO the best language - powerful and lightweight), but it's too much for me in such a hurry.
But unfortunately I thought I would just paste it in the beginning of some int main() and it would work, but is far beyond that... Too many source files and none of them worked. Thanks anyway!
But unfortunately I thought I would just paste it in the beginning of some int main() and it would work, but is far beyond that... Too many source files and none of them worked. Thanks anyway!
Free the file descriptor back to the system and then unlink it.
This User Gave Thanks to matrixmadhan For This Post:
Oh, I understand! Thanks! The problem now is that I don't know where to paste this piece of code. I don't know which source file generates the binary... There are too many source files, and none of them is named like the originated binary... From the Makefile is difficult to find it out.
This is an excellent video comment on modern society and the remix is good too:
https://www.youtube.com/watch?v=5DU1B_XkyIk
5DU1B_XkyIk
Watch the video above and post your comments. (3 Replies)
Hello!
I have a question to native English-speaking people. In the popular program's "hello world" greeting, what meaning the "world" has: "all", "everybody", "people", "friends" or "whole world", "planet", "Earth", "Universe"?
In other words, to whom this greeting is addressed: to the... (14 Replies)