cin.getline hates forward slashes?

Hi everyone, I am doing an assignment where I am reading from a textfile via input stream. It is a database of title, first name, last name and position in the company.
I have got the first two records to print out fine, then on the third line, where the title in the text file is "A/PR", my program prints out "A/" and then crashes violently and I get a bomb of errors (that would be because it is in the while loop still giving nonexistent values to the rest of the array, I understand that.

So I came to the conclusion it is because of the forward slash. I could be completely wrong, but is there a way to make getline not treat the forward slash like a bomb threat and freak out?

Thanks for the help :)
PS: We cannot use strings, only cstrings (I WISH!!!!)

1
2
3
4
5
6
7
8
  while(!inFile.eof() && numRecords < MAX)
	{
		inFile.getline(staffRecords[numRecords].title, 5, '\t');
		inFile.getline(staffRecords[numRecords].fName, 15, '\t');
		inFile.getline(staffRecords[numRecords].sName, 15, '\t');
		inFile.getline(staffRecords[numRecords].position, 30, '\t');
... etc
I don't think the forward slash is the problem. You could replace the forward slash with another character and see if it still crash just to make sure.

You say you get errors. What kind of errors. Do they say what the problem is?
Topic archived. No new replies allowed.