cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
text
text
Jan 23, 2011 at 9:39pm UTC
theimmortalbg
(24)
Hello how i can save text in char[] inputed with cin without knowledge how much characters there is in the text in advance? Thanks.
Jan 23, 2011 at 9:41pm UTC
Zhuge
(4664)
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.
Jan 23, 2011 at 9:45pm UTC
Computergeek01
(5613)
See Here for more reading on what Zhuge is talking about:
http://www.cplusplus.com/reference/string/string/
Jan 23, 2011 at 10:20pm UTC
theimmortalbg
(24)
how i can dynamically resizing the array
Topic archived. No new replies allowed.