主题:在vc++ 6.0中如何实现拷贝目录?
			 水中剑客
				 [专家分:0]  发布于 2007-06-29 15:01:00
 水中剑客
				 [专家分:0]  发布于 2007-06-29 15:01:00							
			在vc++ 6.0中如何实现拷贝目录中的所有文件以及子目录到另外一个目录,有没有这样的函数呢?请高手指点
						
					 
		
			
回复列表 (共6个回复)
		
								
				沙发
				
					 InitInstance [专家分:8720]  发布于 2007-06-29 21:52:00
InitInstance [专家分:8720]  发布于 2007-06-29 21:52:00				
				有,SHFileOperation用这个API就可以了
							 
						
				板凳
				
					 hn_lijianguo [专家分:540]  发布于 2007-07-02 09:09:00
hn_lijianguo [专家分:540]  发布于 2007-07-02 09:09:00				
				#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{ 
 const int bufSize = 1024; 
 string s;
 cout<<"please input a file pathname:"; 
 cin>>s; 
 ifstream from(s.c_str(), ios_base::binary);
  if(!from) 
 {  
     cout<<"cannot open the file:"<<s<<endl;  
     return 0; 
 }
 cout<<"please input a file new pathname:"; 
cin>>s; 
ofstream to(s.c_str(), ios_base::binary); 
if(!to) 
 {  
  cout<<"cannot open the file:"<<s;  
  return 0; 
 }
 char buf[bufSize];
 int inBytes; 
  do
 {  
   from.read(buf, bufSize);
   inBytes = from.gcount();
   to.write(buf, inBytes); 
  }while(inBytes == bufSize);
  from.close(); to.close();
  system("pause"); 
 return 0;
}
//Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=755467
							 
						
				3 楼
				
					 hn_lijianguo [专家分:540]  发布于 2007-07-05 09:12:00
hn_lijianguo [专家分:540]  发布于 2007-07-05 09:12:00				
				#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{ 
 const int bufSize = 1024; 
 string s;
 cout<<"please input a file pathname:"; 
 cin>>s; 
 ifstream from(s.c_str(), ios_base::binary);
  if(!from) 
 {  
     cout<<"cannot open the file:"<<s<<endl;  
     return 0; 
 }
 cout<<"please input a file new pathname:"; 
cin>>s; 
ofstream to(s.c_str(), ios_base::binary); 
if(!to) 
 {  
  cout<<"cannot open the file:"<<s;  
  return 0; 
 }
 char buf[bufSize];
 int inBytes; 
  do
 {  
   from.read(buf, bufSize);
   inBytes = from.gcount();
   to.write(buf, inBytes); 
  }while(inBytes == bufSize);
  from.close(); to.close();
  system("pause"); 
 return 0;
}
							 
						
				4 楼
				
					 xiaomer [专家分:0]  发布于 2010-07-25 22:51:00
xiaomer [专家分:0]  发布于 2010-07-25 22:51:00				
				
int copyFiles(char *strFromPath,char *strToPath)
{
    typedef int (WINAPI ICEPUB_COPYFILES)(char *strFromPath,char *strToPath);
    ICEPUB_COPYFILES *icePub_copyFiles = 0;
    HINSTANCE hDLLDrv = LoadLibrary("icePubDll.dll");
    if(hDLLDrv)
    {
        icePub_copyFiles = (ICEPUB_COPYFILES *)GetProcAddress(hDLLDrv, "icePub_copyFiles");
    }
    icePub_copyFiles(strFromPath,strToPath);
    if(hDLLDrv)
        FreeLibrary(hDLLDrv);
    return 0;
}
//http://icese.net/read.php?tid=8499
//可下icePubDll.dll
							 
						
				5 楼
				
					 moke9 [专家分:30]  发布于 2010-08-02 17:58:00
moke9 [专家分:30]  发布于 2010-08-02 17:58:00				
				玩农场,玩游戏,不如来玩能赚钱的农场:
全国首创巨大的偷菜赚钱,寻宝赚钱..等等
两类玩家--推广员和免费的玩家
永久免费--任何一个玩家免费玩
寻宝系统--每日10万元现金分享
魔法系统--结出金锭兑现现金
结婚系统--相互关爱,体验爱情
养育系统--上线拥有孩子打招呼
聊天系统--独一无二的聊天系统
届时欢迎团队领导人,抢占高位,抢占先机..
了解没损失,选择很重要,赚钱有方法
 联络QQ908889846  
事业者请浏览http://www.thxt999.com/Member.asp?u_id=cdc666
免费玩奇迹农场:首先打开摩客奇迹农场官方游戏网站.   http://www.ga-me.hk/ 点马上注册.  ID号码是六位数以上的字母和数字组合的都可以.推广员ID号写我的ID cdc666 
							 
						
				6 楼
				
					 moke9 [专家分:30]  发布于 2010-09-02 07:00:00
moke9 [专家分:30]  发布于 2010-09-02 07:00:00				
				你好.我是全职网赚工作者.
如果你有时间有电脑.会打字.
想在网络上创业.请联系我..
项目绝对真实.详情QQ空间资料
加盟请联系 QQ908889846
							 
									
			
我来回复