LaTeX offers the environment
filecontents* which allow you to add external files to your
.tex file. The environments have to be used before the
\documentclass declaration. If you process the
.tex file the files are then written to the local directory (but only if there isn't already a file with that name) and thus can be used as part of the document.
... my changes ...
filecontents environment writes a short header (behind
% signs at the top of the generated file, the star form suppresses that header. The latter is useful if you want to generate a file that needs to be kept unchanged. What is not possible is to add real binary files to your document in that way (e.g., a