hi, can someone explain the following (or better, point me someplace that could explain common command syntax questions). "str" "s" are private char. thanks.
Code:strcpy(str,s);
hi, can someone explain the following (or better, point me someplace that could explain common command syntax questions). "str" "s" are private char. thanks.
Code:strcpy(str,s);
strcpy ( str, s );
This function will take the value of s and place it in str, assuming that there is space allocated for str. The first argument to strcpy is a char * and the second is a const char *. So you can only place s in str if str is a char array or dynamically allocated char *.
-Prelude
My best code is written with the delete key.
also, str has to have enough memory to hold the entire string being copied into it, not just some memory.
>str has to have enough memory to hold the entire string being copied into it
This goes without saying of course, it's only common sense to see that if you are putting stuff in a box there has to be enough room in the box.
I don't immediately assume that someone is completely stupid, they have to earn that right.
-Prelude
My best code is written with the delete key.