Originally posted by PJYelton
Code:
for (int x=0; x<numCharsInFile; x++)
cin>>myString[x];
Not sure if this is the best way, but I believe it'll get every character including spaces. [/B]
cin stops at whitespace and thus will not read it in. If you want to read everything including spaces use the get() or getline() functions. You can look them up here. Also you don't want cin, instead you want an ifstream object to read from the file
Code:
#include <ifstream>
#include <iostream>
int main()
{
char buff[256];
std::ifstream filein("file.txt");
while(filein.get(buff, 256, '\n')){
filein.ignore(5, '\n');
std::cout << buff << std::endl;
}
filein.close();
}
-Futura