CSV file how to break lines? : <p>I've been struggling with parsing a csv file so that every new line is read as a new row. Unfortunately, I couldn't find an answer in the SO forums that addressed my problem. I opened the csv file with textEdit and saw this: </p>

<p><a href="https://i.stack.imgur.com/k484Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k484Y.png" alt="enter image description here"></a></p>

<p>I think the problem is how to tell the compiler when to break off a new line. For example, right now, it will read z (row 2) as being on the previous row. Please take a look at my code and output below (i am using Xcode v 9.2).</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;
#include &lt;vector&gt;
#include &lt;fstream&gt;
using namespace std;

int main()
{
    ifstream ip("ebid2016.csv");
    if (!ip.is_open()) {
        cout &lt;&lt; "can't open file" &lt;&lt; '\n';
    }
    string title;
    string articleId;
    string department;
    string closeDate;
    string bid;
    string inventoryId;
    string vehicleId;
    string receiptNum;
    string fund;
    string nothing;


    while(ip.good()){

        getline(ip,title,'\t');
        getline(ip,articleId,'\t');
        getline(ip,department,'\t');
        getline(ip,closeDate,'\t');
        getline(ip,bid,'\t');
        getline(ip,inventoryId,'\t');
        getline(ip,vehicleId,'\t');
        getline(ip,receiptNum,'\t');
        getline(ip,fund,'\t');

        cout &lt;&lt; "Article Title:" &lt;&lt; title &lt;&lt; '\n';
        cout &lt;&lt; "Article ID:" &lt;&lt; articleId &lt;&lt; '\n';
        cout &lt;&lt; "Department:" &lt;&lt; department &lt;&lt; '\n';
        cout &lt;&lt; "Close Date:" &lt;&lt; closeDate &lt;&lt; '\n';
        cout &lt;&lt; "Bid:" &lt;&lt; bid &lt;&lt; '\n';
        cout &lt;&lt; "Inventory ID:" &lt;&lt; inventoryId &lt;&lt; '\n';
        cout &lt;&lt; "Vehicle ID:" &lt;&lt; vehicleId &lt;&lt; '\n';
        cout &lt;&lt; "Receipt Number:" &lt;&lt; receiptNum &lt;&lt; '\n';
        cout &lt;&lt; "Fund:" &lt;&lt; fund &lt;&lt; '\n';

        cout &lt;&lt; "------------------" &lt;&lt; '\n';
    }
    ip.close();
}
</code></pre>

<p>Output: </p>

<pre><code>Article Title:ArticleTitle
Article ID:ArticleID
Department:Department 
Close Date:CloseDate 
Bid:WinningBid 
Inventory ID:InventoryID
Vehicle ID:VehicleID
Receipt Number:ReceiptNumber 
Fund:Fund
z &lt;------------why does z show up here?
------------------
Article Title:97991
Article ID:POLICE PROPERTY AND EVIDENCE UNCLAIMED
Department:12/1/16
Close Date:$27.00 
Bid:PPEU-031C-149
Inventory ID:
Vehicle ID:3689905552
Receipt Number:Enterprise
Table
Fund:97990
------------------ etc.
</code></pre>
