Using find_first_of() and substr() to seperate a string but I'm getting incorrect output
<p>I'm reading in from a text file that contains some assembly instructions that look like this</p>

<p>[label] opcode [arg1] [,arg2]</p>

<p>Right now I'm only at the stage of reading in the label but when I read from the file and input the labels into an array, I'm getting some blank lines that shouldn't be there. Here is my code</p>

<pre><code>#include &lt;string&gt;
#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;string.h&gt;
#include &lt;fstream&gt;
#include &lt;stdio.h&gt;



using namespace std;


int main(int argc, char *argv[])
{
// If no extra file is provided then exit the program with error message
if (argc &lt;= 1)
{
    cout &lt;&lt; "Correct Usage: " &lt;&lt; argv[0] &lt;&lt; " &lt;Filename&gt;" &lt;&lt; endl;
    exit (1);
}

// Array to hold the registers and initialize them all to zero
int registers [] = {0,0,0,0,0,0,0,0};

string memory [16000];

string Symtablelab[1000];
int Symtablepos[1000];


string line;
string label;
string opcode;
string arg1;
string arg2;


// Open the file that was input on the command line
ifstream myFile;
myFile.open(argv[1]);


if (!myFile.is_open())
{
    cerr &lt;&lt; "Cannot open the file." &lt;&lt; endl;
}

int counter = 0;
int i = 0;
int j = 0;

while (getline(myFile, line, '\n'))
{

    if (line[0] == '#')
    {
        continue;
    }


    if (line[0] != '\t' &amp;&amp; line[0] != ' ')
    {

        string delimeters = "\t";

        int current;
        int next = -1;


        current = next + 1;
        next = line.find_first_of( delimeters, current);
        label = line.substr( current, next - current );

        Symtablelab[i] = label;

        cout &lt;&lt; Symtablelab[i] &lt;&lt; endl;

        i++;

    }


}


return 0;
}
</code></pre>

<p>The output I get from this code is:</p>

<pre><code>blank line
TOP
VAL
TAN
blank line
</code></pre>

<p>I should only be getting:</p>

<pre><code>TOP
VAL
TAN
</code></pre>

<p>Here is the sample text file I'm reading from</p>

<pre><code># Sample Input

    LA 1,3
    LA 2,1
TOP     NOP
    ADDR 3,1
    ST 3, VAL
    CMPR 3,4
    JNE TOP
    P_INT 1,VAL
    P_REGS
    HALT
VAL     INT 0
TAN     LA  2,1
</code></pre>
