Reading to object from .in file
<p>Hello i'm having a list of 3 int's spaced by 2 white-spaces, and i want to read them and create  an object. I will paste my code from data strucutre, class and pre/post data. I cant find the reason for the error. Any help is welcome:</p>

<p>Class.h:</p>

<pre><code>class RAngle{
private:
    int x,y,l,b; 
    int solution,prec;
    RAngle(){
        x = y = solution = prec = b = l = 0;
    }

    RAngle(int i,int j,int k){
        x = i;
        y = j;
        l = k;
        solution = 0; prec=0; b=0;
    }

    friend ostream&amp; operator &lt;&lt; (ostream&amp; out, const RAngle&amp; ra){
        out &lt;&lt; ra.x &lt;&lt; " " &lt;&lt; ra.y&lt;&lt;" " &lt;&lt; ra.l &lt;&lt;endl;
        return out;
    }

    friend istream&amp; operator &gt;&gt;( istream&amp; is, RAngle&amp; ra){
        is &gt;&gt; ra.x;
        is &gt;&gt; ra.y;
        is &gt;&gt; ra.l;

        return is ;
    }

};
</code></pre>

<p>dataStructure.h:</p>

<pre><code>template &lt;class T&gt;
class List
{
private:
    struct Elem
    {
        T data;
        Elem* next;
    };

    Elem* first;

    void push_back(T data){
    Elem *n = new Elem;
    n-&gt;data = data;
    n-&gt;next = NULL;
    if (first == NULL)
    {
        first = n;
        return ;
    }
    Elem *current;
    for(current=first;current-&gt;next != NULL;current=current-&gt;next);
    current-&gt;next = n;
}
</code></pre>

<p>main.cpp:</p>

<pre><code>void readData(List &lt;RAngle&gt; &amp;l){
    *RAngle r;
    int N;
    ifstream f_in;
    ofstream f_out;

    f_in.open("ex.in",ios::in);
    f_out.open("ex.out",ios::out);

    f_in &gt;&gt; N;
    for(int i=0;i&lt;13;++i){
        f_in &gt;&gt; r;
        cout &lt;&lt; r;
        l.push_back(r);
    }

    f_in.close();
    f_out.close();
}*
</code></pre>

<p>input data: </p>

<pre><code>3 1 2
1 1 3
3 1 1
</code></pre>

<p>output(at printing when reading):</p>

<pre><code>1 2 1
1 3 3
1 1 3
</code></pre>

<p>As you can see somehow it starts reading with 2-nd position and finishes with first.</p>
