Why use char for cin.getline()?

I'm new to c++ and came across this in one of the examples:
1
2
3
4
5
 char filename[81];
    char input_line[81];

    cout << "Enter a file name and press ENTER: ";
    cin.getline(filename, 80);


I don't get why you couldn't use a string and just read the entire string...Why do we need to use characters to read a line of text?
You can. It's more complicated to parse.
In fact, it's preferable to use std::strings when taking input, as they prevent such things as buffer overflow attacks.
Topic archived. No new replies allowed.