Inside the infile.txt, I'm suppose to convert into outfile.txt. Unforunately, I'm unable to get the correct aglinment for outfile. As you can see, France and Vietnam have an extra "\t".

char ch;

switch (n)
{

    case 'F':   stud.type = n;
    infile >> stud.st.fs.country;
    infile.get(ch);
    infile.getline(stud.st.fs.name, MAX);
    break;

    case 'S':  stud.type = n;
    infile.get(ch);
    infile.getline(stud.st.ls.name, MAX);
    break;        
}

Let's say if i were to put another infile.get(ch); the first character of the foreigner will be remove except France and Vietnam as shown in the outfile2.txt

    char ch;

    switch (n)
    {

        case 'F':   stud.type = n;
        infile >> stud.st.fs.country;
        infile.get(ch);
        infile.get(ch);
        infile.getline(stud.st.fs.name, MAX);
        break;

        case 'S':  stud.type = n;
        infile.get(ch);
        infile.getline(stud.st.ls.name, MAX);
        break;        
    }

Can someone help me solve this problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.