Procedure TForm1.Button1Click(Sender: TObject);
var
FromF,ToF : file of byte;
Buffer : array[0..4096] of char;
NumRead : integer;
FileLength : longint;
begin
Source:='c:\demo.txt';
Destination:='d:\demo.txt'
AssignFile(FromF,Source);
reset(FromF);
AssignFile(ToF,Destination);
rewrite(ToF);
FileLength:=FileSize(FromF); //源文件的大小
With Progressbar1 do
begin
Min := 0;
Max := FileLength;
while FileLength > 0 do
begin
BlockRead(FromF,Buffer[0],SizeOf(Buffer),NumRead);
FileLength := FileLength - NumRead;
BlockWrite(ToF,Buffer[0],NumRead);
Position := Position + NumRead;
end;
CloseFile(FromF);
CloseFile(ToF);
end;
end;
该程序是成功的,现在我把源文件Source:='c:\demo.txt';换成网络某台机上的文件
Source:='\\fornet-177\update\demo.txt';便报错如下
Project Project1.exe raised exception class EInOutError with message
'File access denied'.Process stopped.Use Step or Run to continue.
怎么不能拷贝网络上的文件么?
var
FromF,ToF : file of byte;
Buffer : array[0..4096] of char;
NumRead : integer;
FileLength : longint;
begin
Source:='c:\demo.txt';
Destination:='d:\demo.txt'
AssignFile(FromF,Source);
reset(FromF);
AssignFile(ToF,Destination);
rewrite(ToF);
FileLength:=FileSize(FromF); //源文件的大小
With Progressbar1 do
begin
Min := 0;
Max := FileLength;
while FileLength > 0 do
begin
BlockRead(FromF,Buffer[0],SizeOf(Buffer),NumRead);
FileLength := FileLength - NumRead;
BlockWrite(ToF,Buffer[0],NumRead);
Position := Position + NumRead;
end;
CloseFile(FromF);
CloseFile(ToF);
end;
end;
该程序是成功的,现在我把源文件Source:='c:\demo.txt';换成网络某台机上的文件
Source:='\\fornet-177\update\demo.txt';便报错如下
Project Project1.exe raised exception class EInOutError with message
'File access denied'.Process stopped.Use Step or Run to continue.
怎么不能拷贝网络上的文件么?
解决方案 »
- 请问各位高手,Delphi怎么在指定的地方嵌入(链接)别的窗体呢?
- 菜鸟问题,一两句话形容不出(所以网上无从差找),求高手援手
- dxbarmanager的使用问题
- 关于TobjectList的一点疑问
- 网上找不到答案,只能问了。关于DLL的问题?
- 有关数据备份的
- ActviexForm能否像Activex控件一样使用?
- 用Indy的IdSMTP编写邮件发送软件,如何设定连接超时?
- 最近在写一个数据库程序,经常切换用户登陆,很是麻烦,于是写了一个程序摆平!
- 怎么把MEMO中的内容打印出来,包括因滚动条原因没有显示出来的部分?
- 我要在拷贝文件时用进度条控件显示拷贝进度该怎么做?
- 程序在运行期出现的一个特别奇怪的问题﹐望各位大虾关注...急......
先用资源管理器访问一下那电脑再试试看。