相关疑难解决方法(0)

strcpy和stpcpy有什么区别?

在阅读手册页时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意味着什么呢?

c string

17
推荐指数
3
解决办法
1万
查看次数

C中字符串连接的代码太多

我的代码中有很多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)

c string

1
推荐指数
1
解决办法
330
查看次数

标签 统计

c ×2

string ×2