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
string class to array
string class to array
Nov 7, 2010 at 5:36am UTC
pistol1
(10)
I am reading a single line of text from a file and want to read it as a string class then fill an array with the string. Is this possible. I want to use the c++ string class to avoid the null terminator.
Nov 7, 2010 at 7:20am UTC
jamesmk
(60)
Yes, this is possible.
You can use something like str.size(), and str[x] to go through the string, if you name your string str.
http://www.cplusplus.com/reference/string/string/size/
Hope this helps!
Last edited on
Nov 7, 2010 at 7:23am UTC
Nov 7, 2010 at 4:58pm UTC
firix
(438)
of course You can read.
getline to use it.
Topic archived. No new replies allowed.