[Tex/LaTex] enter code directly from a source file

documentationminted

In a project I'm working, all the files are in the same folder (source codes, papers, images, etc).

In the documentation, I'm including some code with minted which is really great, but I want to do something like this:

\begin{minted}{c}
    \input{main.c}
\end{minted}

I know that won't work, but you can see what I want to do. The reason for this, is because I don't want to update documentation every time I change a source file, do you understand? The idea is to leave main.c as it is, and include that file automatically in the documentation.

Best Answer

Try \inputminted{c}{main.c} or generally \inputminted[options]{language}{filename} -- see page 4 of the minted manual.