Q: c++ - std::getline reads non existing characters I am currently using Visual Studio 2013.
I have a basic txt file, which has records on each line, and each record are seperated with semicollums in it.For instance:
A;James;Jones;N;2;deposit;withdraw
P
A;George;clooney;P;3;deposit;credit;withdraw
P
V
P
A;Charlie;Chaplin;P;2;withdraw;credit
P
V
P
R;Ali;Aksu;N
P
s;Ali;Aksu
E

I am using a simple code that I found online, just to print it to the screen:
#include <iostream>
#include <stdlib.h>
#include <iomanip>
#include <ctype.h>
#include <string>
#include <string.h>
#include <fstream>
#include <sstream>

using namespace std;

int main(){
ifstream    file("input_file.txt");
string      line;
if (file)
{
    string token;
    stringstream iss;
    while (getline(file, line))
    {
        iss << line;
        while (getline(iss, token, ';'))
        {
            cout << token << endl;
        }
        iss.clear();
    }
}
system("PAUSE");
return 0;
}

But when I run the program, it puts some nonexisting characters in the beginning of the output, this is the first line of the output when compiled on SSH with g++:

A

What is the reason of this, I am trying to use std::getline in a bigger project, but this affects all of the program structure. What is the solution?
Thank you very much.
