Q:

Reading the data to iterate over with \foreach from a file

I have a \foreach that should read the data points from a file. The points are stored in such a way that a simple copy paste would do. In fact, I don't want to do more than copy paste (if ever possible). I found that \input does not work. There are a couple solutions around but they seem to do more than copy-paste. Is there an "easy" way to achieve that? 
document.tex:
\documentclass[border=5mm]{standalone}
\usepackage{tikz}

\begin{document}
  \begin{tikzpicture}
  \foreach \from/\to in { \input{data}; } %input does not work...
  {\draw [->] \from -- \to;}

  \end{tikzpicture}
\end{document}

data.dat:
{(1,1)}/{(3,3)},
{(-1,1)}/{(-3,3)},
{(1,-1)}/{(3,-3)}%

A:

You can use catchfile:
\begin{filecontents*}{\jobname.dat}
{(1,1)}/{(3,3)},
{(-1,1)}/{(-3,3)},
{(1,-1)}/{(3,-3)}%
\end{filecontents*}

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usepackage{catchfile}

\newcommand\loaddata[1]{\CatchFileDef\loadeddata{#1}{\endlinechar=-1}}

\begin{document}

\begin{tikzpicture}
\loaddata{\jobname.dat}
\foreach \from/\to in \loadeddata{\draw [->] \from -- \to;}
\end{tikzpicture}

\end{document}

With \endlinechar=-1 we effectively remove the end-of-lines in the loaded file.

A:

Interesting approach. The problems you are encountering stem from the fact that each segment is on a separate line in data.dat and that the \foreach argument should be expanded first. The following reads the contents of the data.dat file (the \loaddata command, which is based on this answer) and appends each line to the end of the \loadeddata command, resulting in all of the data on a single line ({(1,1)}/{(3,3)},{(-1,1)}/{(-3,3)},{(1,-1)}/{(3,-3)}% in your example). This is then expanded and used as the argument in the \foreach call.
\begin{filecontents*}{data.dat}
{(1,1)}/{(3,3)},
{(-1,1)}/{(-3,3)},
{(1,-1)}/{(3,-3)}%
\end{filecontents*}
\documentclass[border=5mm]{standalone}
\usepackage{tikz}

\makeatletter
    \newread\dataread
    \def\loaddata#1{%
        \gdef\loadeddata{}%
        \openin\dataread=#1
        \begingroup\endlinechar=-1
        \@whilesw\unless\ifeof\dataread\fi{%
            \read\dataread to \dataline
            \edef\rslt{\noexpand\g@addto@macro\noexpand\loadeddata{\dataline}}%
            \rslt%expanded argument
        }%
        \endgroup
        \closein\dataread
    }%
\makeatother

\begin{document}
  \begin{tikzpicture}
    \loaddata{data.dat}
    \edef\expfor{\noexpand\foreach \noexpand\from/\noexpand\to in {\loadeddata}}
    \expfor{\draw [->] \from -- \to;}
  \end{tikzpicture}
\end{document}

