Alvin ONeal wrote:
> // Or this
> char * myCString;
> strcpy(myCString, "My C string");

The correct way to do this is:

char *myCString;
myCString=strdup("My C string");

or for more safety use strndup.

You'll of course have to free the string later.

--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info (unsubscribe here): http://uug.byu.edu/mailman/listinfo/uug-list

Reply via email to