如何将文件拷到另一个目录中?
我要将一个图片拷贝到相对路径中的一个文件夹中(map 文件夹,他在资程序目录中,但如果整个程序拷贝到其它地方,所以要使用相对目录)。
copyfileto(openpicturedialog1.filename,'..\map\'+name+'.bmp');//name存放图片拷贝到另一个地方的名称。当是不知错在那里。
我要将一个图片拷贝到相对路径中的一个文件夹中(map 文件夹,他在资程序目录中,但如果整个程序拷贝到其它地方,所以要使用相对目录)。
copyfileto(openpicturedialog1.filename,'..\map\'+name+'.bmp');//name存放图片拷贝到另一个地方的名称。当是不知错在那里。
解决方案 »
- 请较这用什么打开,属于什么文件
- FASTREPORT4 中文显示问题
- 请教各位一个问题,在dephi中查询到数据后,如果实现象在PL/SQL Developer那样,点击一个图标,可以使得查询的一行以列表示?
- 为什么delphi的预定义没有涵盖全部的Windows API
- 求救word文件存入数据库中 用的TBlobField 在uses 用到什么?
- 考勤系统中的采集数据问题!(用源码求解!)
- shaver做爸爸了,给大家散散分同喜
- 关于InstallShield Professional Edition 6.22使用
- 关于C/S结构下的listview控件?
- 有ERP规划、开发经验的高手请进,分数没问题!
- 如何取的VFP中的某个表中某个字段的类型、长度?
- 在打开ADOQuery时,为什么会出现“From子句语法错误”的提示?难道和表名有关?
CopyFile(LPCTSTR lpszExistingFile, LPCTSTR lpszNewFile, BOOL fFailIfExists);
那你那个例子中的数据来说应该是这样
CopyFile(pchar(openpicturedialog1.filename),pchar(GetCurrentDir+name+'.bmp'),false);
最后那个false是什么意思。
谢谢!
LPCTSTR lpNewFileName, // pointer to filename to copy to
BOOL bFailIfExists // flag for operation if file exists
);
ParameterslpExistingFileNamePoints to a null-terminated string that specifies the name of an existing file. lpNewFileNamePoints to a null-terminated string that specifies the name of the new file. bFailIfExistsSpecifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
那在这个文件夹下的map应是:
CopyFile(pchar(openpicturedialog1.filename),pchar(GetCurrentDir+‘\map\’+name+'.bmp'),false);是吗?
CopyFile(pchar(openpicturedialog1.filename),pchar(GetCurrentDir+‘\map\’+name+'.bmp'),false)//把用户打开的图片,要保存到源程序的map目录下。
用GetCurrentDir不对啊!!!??
当程序打包后,用户安装后,会在他的安装目录下产生map文件夹。然后在把用户打开的图片拷到map文件夹下。