i have been having problems inputting some data from a file and i am clueless as to why i keep getting the output i do.
This is a partial part of my code but as you can see from my output for some unkown reason I am not inputting an entire line when i use the getline function
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
string title;
string author;
string call_number;
string status;
char C;
ifstream inFile;
inFile.open("FileName.txt");
while(!inFile.eof())
{
getline(inFile, title);
getline(inFile, author);
inFile >> C;
inFile >> call_number;
inFile >> status;
inFile.ignore('\n'); //used to skip a line
cout << title << endl;
cout << author << endl;
cout << call_number << endl;
cout << status << endl;
}
here is the file i am reading from
Absolute C++ (3rd Edition)
Walter Savitch
C1
1
Bello, Topics In Contemporary Math Ninth Edition
Ignacio Bello, Jack R. Britton, and Anton Kaul
C2
1
C++ Primer Plus (5th Edition)
Stephen Prata
C3
0
C++ Programming: From Problem Analysis to Program Design, Fourth Edition
D.S. Malik
C4
1
and the output i get is excluding the letters from only the first line.
Absolute C++ (3rd Edition)
Walter Savitch
1
1
Topics In Contemporary Math Ninth Edition
Ignacio Bello, Jack R. Britton, and Anton Kaul
2
1
mer Plust (5th Edition) //notice the missing letters :(
Stephen Prata
3
0
gramming: From Problem Analysis to Program Design, Fourth Edition
D.S. Malik
4
1