Forum > Unix

How to set file permission programmatically? I've created a compiler

(1/1)

Mussel:
Hi, I have written a simple back-end compiler for Linux x64 using Pascal which supports two commands only: ReadLine and WriteLine.

Now the issue is after my compiler generating the ELF64 binary program, I do not know how to set the file permission so that it can be allowed to execute.

In the mean time, I have to set each one manually:

--- Code: ---chmod u=rwx,g=rx,o=rx test
--- End code ---

BTW, if anyone is interested, can try this back-end compiler, open-source.
ELF64 binary file format is quite simple if used with only sys_read and sys_write.

https://github.com/khanming/Pipit

marcov:
If you had searched on chmod in the manuals, you would have found:

https://www.freepascal.org/docs-html/rtl/baseunix/fpchmod.html

Navigation

[0] Message Index

Go to full version