我想将我的最终版本部署为带有应用程序Icon的EXE.
做这个的最好方式是什么?常见的做法是什么?
我有以下函数将传递的参数写入二进制文件.
void writeFile(FILE *fp, const int numOfChars, ...)
{
va_list ap;
va_start(ap, numOfChars);
for(int i = 0; i < numOfChars; i++)
{
const char c = va_arg(ap, char);
putc(c, fp);
}
va_end(ap);
}
Run Code Online (Sandbox Code Playgroud)
编译后,我从编译器收到以下警告
warning: second argument to 'va_arg' is of promotable type 'char'; this va_arg
has undefined behavior because arguments will be promoted to 'int' [- Wvarargs]
Run Code Online (Sandbox Code Playgroud)
现在据我了解,C想要将char类型提升为int.为什么C想要这样做?第二,是将int转换回char的最佳解决方案吗?
我制作了一个执行的makefile go test -cover.make unit_tests如果覆盖率低于X,是否可能使命令失败?我该怎么办?
我有以下方法:
17 //returns size in bytes of binary file stream
18 //leaves the file at original position
19 long getFileSize(FILE * fp)
20 {
21 long pos = -1;
22 fpos_t *curPos;
23 if(fgetpos(fp, curPos) == 0)
24 {
25 fseek(fp, 0L, SEEK_END);
26 pos = ftell(fp);
27 fsetpos(fp, curPos);
28 }
29
30 return pos;
31 }
Run Code Online (Sandbox Code Playgroud)
这将编译和工作,但编译器会给我一个警告,因为curPos不是一个初始化变量.
如果我将该行更改为(编译器推荐)
22 fpos_t *curPos = NULL;
Run Code Online (Sandbox Code Playgroud)
我收到一个段错误.
为什么会这样?
c ×2
go ×2
arguments ×1
deployment ×1
exe ×1
executable ×1
java ×1
makefile ×1
pointers ×1
wrapper ×1