I'm trying to fill text document, but when I do - I get first line blank. My text document, I'm reading from, looks like this:
3
first fr random 5
second 9
third shazam 2
I've tried removing first value and so blank line went away. So it correlates, but I need that value.
// My code
ifstream in("U2.txt");
ofstream out("U2.txt");
int n;
in>>n;
char vardaiStart[n][21];
in.read(vardaiStart[0], 21);
out << vardaiStart[0]<< endl;
output looks like this:
*blank*
first fr random
but what I want is:
first fr random
So, in other projects I won't be using old C since now, but for this project I red that [endline] and ignored it like this: in.ignore(std::numeric_limits<std::streamsize>::max(), '\n');