Read/write data then separate data
<p>I am a newbie in C++. I am doing a C++ sign up form where I keep all the user datas in a text file named user.txt with formats like</p>

<pre><code>name|password|address|postal|phone
</code></pre>

<p>Each user record will occupy one line.</p>

<p>So my first question how can I do this nicely in C++</p>

<p>As for the reading part, my main problem is how to separate the data by splitting "|" then put the records in a user array. So when I do a login function I can loop through the array to match users.</p>

<p>My current code for reading is</p>

<pre class="lang-c prettyprint-override"><code>string User::readUser(){
    ifstream fin("user.txt");
    string line;
    while(getline(line,fin)){
        string name, password, address; int postal, phone;//put the records into a 2 dimention array
    }
    //return array
}
</code></pre>
