<string> vs <cstring>

Hi, whenever you have a choice,
is it better programming practice to use <string > members or <cstring> members?

Thanks.
pgmerLAAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
That's quite straightforward - if you want to do it the C++ way, use '<string>', if you want to deal with NULL-terminated C-style strings, '<cstring>' is your friend.
0
 
phoffricConnect With a Mentor Commented:
To complicate the matters, if writing C++, then naturally, as jkr said, <string> is preferred; however, when the application is mixed, with library functions, such as socket based applications, where the char* values are needed, then you need a mixture. And, sometimes, it becomes a little tricky to get the program working with both usages (but that is no reason to stop you from learning the correct way).
0
 
pgmerLAAuthor Commented:
Thanks guys.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.