I am trying to use strncpy to only copy part of a string to another string in C.
Such as:
c[] = "How the heck do I do this";
Then copy "do this" to the other string, such that:
d[] = "do this"
Help is appreciated.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just pass the address of the first letter you want to copy:
strcpy(dest, &c[13]).If you want to end before the string ends, use
strncpyor, better,memcpy(don’t forget to 0-terminate the copied string).