C++ File Read Manipulation
Background: Not too new to C++, never learned professionally, sparatic hobbie.
I am trying to create a game that requires reading of a file, but in entire line of code.
I can do it by switching it:
Code:
char name[256];
cout << "Enter Game File: ";
cin.getline (name, 256);
ifstream ifs(name);
string line;
while(getline(ifs,line))
{
cout << line << endl;
}
return 0;
But the file i am trying to access has values that i need to be able to use, but it is now in bool form. I could use the
Code:
main()
{
string line;
while( getline(cin, line) )
cout << line << '\n';
}
but this is not practical because i need more manipulation...
is there a way to use the first example and parse the bool values back to integers?
the file would look something like
[file.txt]
string of words
string of words
2
string of words
8 (or some value in the form of an integer)
Sorry if my english is not well.
Thank you in advance