the string is undefined in your program because it is defined in a file called...
Code:
#include <string.h>
or
Code:
#include <cstring>
using namespace std;
if u want to read more than one line u could put it into a while loop... for instance..
Code:
#include <fstream>
int main()
{
ifstream file; // file of type input file stream;
file.open("filename.txt"); //open filename.txt
string info;
file.getline(info, 50); // get first line of text file and store in info;
cout << info; //output info to screen.
while(file.eof() == false) // while it is not the end of the file.
{ // repeat loop over and over..
file.getline(info, 50);
cout << info; //output info to screen.
}
file.close(); // close the file.
return 0;
}
this is just one way to do it.. there are tons of variations..
get()
file >> info
and the list goes on.. and on.. and on....