one-dimensional array of char from text document

Hi everyone,
I'm supposed to write a one-dimensional array that uses the first line of a text document but I have no idea how to do this. Can anyone explain to me how?

Sure,

1: Open the target file with an std::ifstream object: http://www.cplusplus.com/reference/fstream/ifstream/ifstream/
1a: The file path can be a full or a relative path. The relative path perspective depends on the IDE you are using.

2: Make sure the file is open with is_open: http://www.cplusplus.com/reference/fstream/ifstream/is_open/

3: Since you're using a char array I suggest using the read function: http://www.cplusplus.com/reference/istream/istream/read/

4: Close the file when you are done: http://www.cplusplus.com/reference/fstream/ifstream/close/
Topic archived. No new replies allowed.