I want to declare character array and later want to fill it. But getting error:
char line[BUFSIZE+1];
strcpy(line,"Memory is Full", sizeof(line));
Error is:
wrong number of arguments in call to strcpy.
Is there any alternative to achive this?
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.
strcpy()takes 2 arguments,strncpy()takes 3.I think you were thinking about using strncpy, that takes destination, source, and size.
ie:
Note: You have to append the
'\0'yourself if you completly fill your char[], otherwisestrncpy()will do it for you (as in my example).