I have read in tab delimited information using getline. My code looks like this:
getline(inFile1, books[indexData].item_name, '\t'); //storing in an array of structures
So far as I can tell it works, because when I outfile to a test file I get all the proper values returned. However, when I do output to a file, I get an extra single quote around each data component; i.e. 'book title' instead of book title, the latter being how it was in the original input file. Here is my output code:
outFile << books[indexData].item_name << "'\t'";
I thought after this first course in programming that I had a decent understanding of strings, but I cannot figure out why it is outputting with the single quotes. Perhaps I'm lost somewhere in the subtleties between character arrays and strings. Any explanation as to why this happens would be greatly appreciated. An example of how to get rid of it would be even better. :-)
That did the trick. I completely missed the fact that I had the tab character in double quotes. Thanks so much! I would have torn the textbook up before figuring out that problem.