欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C++中圖片重命名實(shí)現(xiàn)代碼

 更新時(shí)間:2017年05月21日 13:12:31   投稿:mdxy-dxy  
這篇文章主要介紹了C++中圖片重命名實(shí)現(xiàn)代碼,需要的朋友可以參考下

非常簡(jiǎn)單的小程序,滿足自己的需求。

#include <iostream>
#include <fstream>
#include<sstream>
using namespace std;
 
int main()
{
  int i=1,j=1;   //本人程序中,i 和 j 是介于(0-9之間的數(shù)字),為了簡(jiǎn)單起見,這里給定初始值。
  string fname1= "C:\\Users\\Administrator\\Desktop\\121.bmp";  //源文件
  string fname2 = "C:\\Users\\Administrator\\Desktop\\";
 
  ostringstream oss;
  oss<<i<<j<<".bmp";
  fname2 += oss.str(); //將int型變量和string變量相加在一起
  //cout<<fname2<<endl;
 
  fstream f;
  f.open(fname1.c_str());
  if(!f)
  {
    cout<<"圖片不存在!"<<endl;
  }
  else
  {
    
    rename(fname1.c_str(),fname2.c_str());
    cout<<"成功將重命名為"<<endl;
 
    f.close();
  }
 
  return 0;
 
}

文章到此結(jié)束,需要的朋友可可以參考一下。

相關(guān)文章

最新評(píng)論