cin.getline() should solve all of your problems.
here is a program in fstream that will show all of the contents of the file, and display the number of rows:
Code:
#include <fstream.h> //file I\O
#include <iostream.h> //guess?
//MAIN////////////////////////////////////////////////
int main(void){
char str[600]; //string array of 600
int rows=0;
ifstream file;
file.open("C:\\Poope.txt"); //open C:\Poope.txt
while (!file.eof())//the end of the file(eof)
{
file.getline(str, 90);
cout << str << endl; //outputs the first 90 characters of the file
rows++;
}
cout << "\n\n\nYour number of rows are: " << rows <<endl;
file.close(); //close the file
return(0);
}
//END OF PROGRAM/////////////////////////////////////
I hope you can build from that. This Program has no trouble with going to the next line, or printing a space and such.