[英]I get the error message:Expression: (L “String is not null terminated” & & 0)
[英]Expression: (L “String is not null terminated” & & 0)
我在摆弄邮筒,现在遇到了问题。 每当我尝试运行时,都会在标题中显示错误消息,但是我不知道应该如何解决。 我正在尝试做的是“固定”邮槽的完整路径,但似乎不喜欢strcat_s-part。
HANDLE mailslotCreate (char *name) {
char fullName[50] = "\\\\.\\mailslot\\";
strcat_s(fullName, strlen(fullName), name);
return CreateMailslot(fullName, 0, TIME_OUT, NULL);
}
编辑:将strlen更改为sizeof仅将错误更改为“ Buffer size too small”。
请参阅有关strcat_s的文档。 它说第二个参数应该是目标缓冲区的大小。 当您传递strlen(fullName)
,没有终止\\0
。
将其更改为sizeof(fullName)
,您的错误应消失。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.