警告:c++中的system()
warning: for system() in c++
我有一个c++程序
我通过system();
函数调用ImageMagick command
它工作在一些简单的命令
但是当我调用这个命令
sprintf(command, "convert -threshold 25% f1/file%.3d.png f2/file%.3d.png", num,num);
system(command);
它给我警告说
warning: format ‘% f’ expects type ‘double’, but argument 3 has type ‘int’
我知道因为%
在命令25 % f
1有不同的意义
您必须写25%%
而不是25%.
以转义'%'符号
如果需要包含%
字符,则使用%%
:
sprintf(command, "convert -threshold 25%% f1/file%.3d.png f2/file%.3d.png", num,num);
为了获得字面上的百分号,需要写%%
,即在您的情况下:
sprintf(command, "convert -threshold 25%% f1/file%.3d.png f2/file%.3d.png", num,num);
相关文章:
- 导出 c++ 函数并使用 c# System.AccessViolationException 中的函数
- g++ 中的 system() 函数
- 使用 (cin) 用户输入将其粘贴到 std::system 中,并在另一个终端中运行带有输入的命令
- 摆脱 TCP 代理中的提升依赖关系. boost::system::error_code等效
- 如何在 c++ 代码中的函数中调用 System() 函数
- 哪一个更好?使用C 代码中的System()函数或使用源代码
- 交叉编译时 NDK 工具链中的 /system/bin/linker 在哪里
- 当使用 stdlib.h 中的 system() 从程序内部运行程序时,如何模拟键入以馈送子程序的 scanf 调用?
- 在 C# 中加载 COM 对象会引发异常"无法将类型'System.__ComObject'的 COM 对象强制转换为接口类型...",但C++或 VB 不会
- 如何在c++中的system()函数中传递字符数组
- monodevelope System.DllNotFoundException调用C++库中的函数
- 从c#中的线程调用c++函数时发生system.access.violation异常
- Visual C#在调用包装的C++CLI dll中的Lapack时引发System.AccessViolation
- 函数 system() 中的输出重定向似乎不起作用
- c++ 中的 clock() 时间和 java 中的 System.CurrentTimeMillis() 之间的时间差
- 如何在 C++ 中的 system() shell 脚本中使用逗号
- 隐藏 sh: -c 在 c++ Linux 中调用“system”时的错误消息
- waitpid()函数是如何在linux中的system()函数中实现的
- 在程序中操作"system"调用的结果C++
- system()中的变量调用c++