在阅读手册页时strcpy,我发现该功能stpcpy也存在.但是,我在手册页中注意到的唯一区别是:
char *
stpcpy(char *s1, const char *s2);
char *
strcpy(char *restrict s1, const char *restrict s2);
Run Code Online (Sandbox Code Playgroud)
那么,这restrict意味着什么呢?
我的代码中有很多strcat行.有没有更好的方法来连接C中的字符串?
char material[50]; // it is defined before this code.
char result[10000];
strcpy(result, "// Assign new material to worldGlobe\n");
strcat(result, "shadingNode -asShader lambert -n ");
strcat(result, material);
strcat(result, ";\n");
Run Code Online (Sandbox Code Playgroud)