|
-
Jul 31st, 2002, 03:23 PM
#1
Thread Starter
Stuck in the 80s
Strings?
What's the advantages/disadvantages of using string.h strings over char[] strings?
Basically, what is your opinions on strings? What kind is what? I know there's others than those two, and I don't even know the technical names for them. But I wish to learn about strings.
-
Jul 31st, 2002, 04:39 PM
#2
Frenzied Member
I like apstrings...other people hate them, but they were what I was taught. Instead of sayinig
char mywords[200];
char word1[20];
char word2[20];
strcat(mywords, word1);
strcat(mywords, word2);
you can just say
apstring mywords;
apstring word1;
apstring word2;
mywords = word1 + word2
apstring (i think string.h too) is much more like VB strings
-
Jul 31st, 2002, 04:39 PM
#3
Frenzied Member
basically they are just easier to handle
-
Jul 31st, 2002, 05:08 PM
#4
Thread Starter
Stuck in the 80s
I really never saw the difference between string and apstring. Our instructor last year made us use apstring because that's what the book said to use and he didn't know any C++.
So I'm not being a bad or lazy programmer by using string.h for my strings?
-
Jul 31st, 2002, 05:16 PM
#5
Fanatic Member
nope
string.h is basically just the same as char*, they've just made it easier to use
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Jul 31st, 2002, 05:50 PM
#6
PowerPoster
string.h is pretty easier to use and it handles all the memory related stuff. Combining/searching/manipulating strings is pretty easy using "string". The only drawback of using "string" is that it won't work in C.
-
Jul 31st, 2002, 05:51 PM
#7
Fanatic Member
One thing though, <string> (the STL string class) is not the same as <string.h> (the non-standard version of <cstring> - strcat(), strcpy(), etc) are two different things. The STL strings are MUCH easier to use though.
Alcohol & calculus don't mix.
Never drink & derive.
-
Jul 31st, 2002, 05:59 PM
#8
PowerPoster
Oh ya, I meant <string>, not <string.h>.
-
Jul 31st, 2002, 08:32 PM
#9
Thread Starter
Stuck in the 80s
Thanks for all the help.
I always use <string> but I thought it was the same as <string.h> News to me
-
Jul 31st, 2002, 10:58 PM
#10
PowerPoster
Ya, <string.h> is C-style but <string> is from STL. If you want some information on how it is then you can this page:
http://www.cs.cf.ac.uk/Dave/C/node19...00000000000000
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|