The listings package provides a key called inputpath for specifying a path where \lstinputlisting should search for source files. Note that inputpath is only documented in the listings developer's guide, not in the user manual; if you haven't compiled the developer's guide, searching for "inputpath" in listings.dtx will lead you to the definition of the inputpath key. To use the latter, simply write
\lstset{inputpath=<path-in-question>}
somewhere in your document (not necessarily in your preamble, but after loading listings, of course). If you really insist on using a macro similar to \graphicspath, you can define an \lstinputpath macro yourself, like so
\newcommand*\lstinputpath[1]{\lstset{inputpath=#1}}
The code below assumes that the file sample.c resides in a subdirectory called test of your working directory.

\documentclass{article}
\usepackage{listings}
\newcommand*\lstinputpath[1]{\lstset{inputpath=#1}}
\lstinputpath{test}
\begin{document}
\lstinputlisting[
language = C,
basicstyle = \ttfamily,
frame = single,
caption = {Hello world in C},
]{sample.c}
\end{document}