Actually I am practicing to make my program separate the 9-digit ID from the numbers while reading from txt file. After that, I want to convert the ID which is a string into char so that I can use the individual characters from the 9-digit ID.
Your code and description don't match.
According to your desired output you want only the first column and ignore the rest but you still try to read all the rest.
To read only the first column you could do it like this;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
cerr << "File error" << "\n";
while (getline(src, line))
auto pos = line.find('\t');
if (pos != string::npos)
name = line.substr(0, pos);
cout << name << "\n";