从C 的文件中删除图像
Deleting images from a file with c++
我想从文件中删除图像,图像命名为:" 1.jpg,2.jpg ....",我已经尝试了上面的代码,但它给了我这个错误:无匹配函数呼叫'remove(std :: __ cxx11 :: string&('
int i;
for (i=0;i<frame;i++)//frame contain the number of images i want to delete
{
std::stringstream ss;
ss << i;
std::string str = ss.str();
const char *cstr = str.c_str();
str=str+".jpg";
remove(str);
}
如果有人可以帮助您在建议方面。
您几乎拥有它。remove
需要const char*
,而不是std::string
。这意味着您需要
remove(str.c_str());
我们也可以摆脱stringstream
并在
std::to_string
for (i=0; i<frame; i++)
{
const std::string str = to_string(i) + ".jpg";
remove(str.c_str());
}
相关文章:
- 将数组的地址分配给变量并删除
- 删除一个线程上有数百万个字符串的大型哈希映射会影响另一个线程的性能
- C/C++编译器通常会删除重复的库吗
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 从链接列表c++中删除一个项目
- C++如何通过用户输入删除列表元素
- 为什么在C++中使用私有复制构造函数与删除复制构造函数
- 如何使用OpenCV将RBG图像转换为HSV,并将H、S和V值保存为C++中的3个独立图像
- OpenCV EqualizeHist()从彩色图像创建黑白图像
- 图像分割 - 删除C 中不需要的像素
- 从C 的文件中删除图像
- 如何在C 中删除或删除.jpg和.dpx图像文件
- sfml pollevent,每个新图像都会删除上一个图像
- 从clistctrl中删除图像
- 从Gtk::TreeStore中删除图像的时髦方法
- 如何从图像中删除矩形轮廓
- 用于删除图像中的非文本区域的开源代码
- C++如何通过删除像素来最佳缩放图像
- 使用OpenCvC++中的原始图像作为掩码,从图像中删除徽标
- 是否可以以编程方式从 JPEG 图像中删除重新启动标记