Till now I guessed that \lstinputlisting{file.ext} just reads the contents of a file and uses it in a lstlisting environment. The sample file below compiles fine, but if I replace the content of the macro with the (my idea was: equivalent) other form, the compilation fails,
\documentclass{memoir}
\usepackage{listings}
\newcommand\MESFN[4][]{
\lstinputlisting{a.c}
% \begin{lstlisting} int i, sum = 0; \end{lstlisting}
}
\begin{document}
\MESFN[]{}{}{}
\end{document}
I found the question (and reply)
Why can lstlisting not be saved in a command?, and I understand why it fails. But, why the other form suceeds? Are there additional differences between providing a file or an immediate content for listings? (and maybe \lstinline also)