I have a code that reads in a text file, and turns each word from the file into a character array (needs to be a character array, no strings allowed) that's a data member of a Word class. When a punctuation is encountered, all the Word objects get stored into a Sentence class as a linked list. When a tab is encountered, all the Sentences before are stored in a Paragraph class as a linked list. What I need help with is a way to check for '\t' in the text file. I'm reading in using
while(myFile >> charArray){
//stuff
}
As this reads in a full word and stores it in charArray
. If it is the end of a sentence, charArray[size]
(size being the last element) will == '.' || == "!" || == "?"
so I can handle making a new Sentence every time (I can assume the text file will be properly formatted every time). What I don't know how to do is how to check for the '\t' character to make a new paragraph. Will '\t' get picked up by myFile >> charArray
? I tried messing around with various if
statements to see if I could pick up a '\t' character but I haven't been able to. So how can I check for a tab while reading in from a text file into a character array?