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
c-string vs. string class objects
c-string vs. string class objects
Oct 27, 2011 at 3:56pm UTC
jmbauer
(11)
i was just wondering when should i use one over the other? should i always use c-strings since it is a part of c++ or should i use string objects since i can include them in console programming. btw im new to this so sorry if it's a dumb question
Oct 27, 2011 at 3:59pm UTC
Athar
(4466)
You should always use C++ strings (that is, std::string).
They're safe and easy to use.
Last edited on
Oct 27, 2011 at 4:01pm UTC
Oct 27, 2011 at 4:01pm UTC
jmbauer
(11)
c++ strings as in:
string myString;
right?
Oct 27, 2011 at 4:02pm UTC
Athar
(4466)
Yes.
Nov 3, 2011 at 2:23pm UTC
jmbauer
(11)
except for structures right? when writing to a binary file don't all strings have to be c-strings?
Nov 3, 2011 at 2:29pm UTC
Moschops
(7244)
No. You can write anything at all to file.
Topic archived. No new replies allowed.