text

Hello how i can save text in char[] inputed with cin without knowledge how much characters there is in the text in advance? Thanks.
You can use an std::string for that purpose. If it has to be a character array, you can either use c_str() and strcpy() to get the data from the string, or you could read sets of characters at a time, dynamically resizing the array as you go.
See Here for more reading on what Zhuge is talking about: http://www.cplusplus.com/reference/string/string/
how i can dynamically resizing the array
Topic archived. No new replies allowed.