On Dec 29, 12:05 pm, Horacius ReX <horacius....@gmail.comwrote:
Hi,
I have a C program split into different source files. I am trying a
new compiler and for some reason it only accepts a single source file.
So I need to "mix" all my different C source files into a single one.
That sounds like one crumy compiler.
>
Do you know about some type of python script able to do this kind of
task ?
No, but we can write one:
import sys
if __name__ == "__main__":
glob = ""
for file in sys.argv[1:-1]:
glob += "\n" + open(file, "r").read()
open(sys.argv[-1], "w").write(glob)
It's stupid, but it'll work for basic tasks. (I would actually just
use cat; that's what it's for. :))
>
Thanks