CString question

Status
Not open for further replies.
Hmmm...I am assuming u want to copy from the middle of x into y. In that case...I would use a for loop :eek: Yeah I know!!! But nothing else comes to mind rite now...

However, if you want to copy from the beginning of the string then strncpy(y, x, 3) would do it. The format is:

  • char *strncpy(char* string1, char* string2, number)


This will copy "number" elements from string2 to string1. The "number" includes the terminating character ('\0') If string 2 is larger than string, then the resultant string1 will not be null terminated.

Hope this helps...

Regards,
Hellfire
:D Constantly working on "it" :D
 
Status
Not open for further replies.