Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Сети";
Текущий архив: 2002.04.08;
Скачать: [xml.tar.bz2];

Вниз

Скопировать файл из локалки   Найти похожие ветки 

 
f0rm   (2002-01-25 11:56) [0]

Как средствами дельфи скопировать файл, например \\198.165.54.2\c\autoexecbat на свой винт, copyfile() не работает


 
Giga-Byte   (2002-01-25 12:00) [1]

Достал на этом сайте:

procedure FastFileCopy(Const InfileName, OutFileName: String); Const BufSize = 3*4*4096; { 48Kbytes дает прекрасный результат }
Type PBuffer = ^TBuffer;
TBuffer = array [1..BufSize] of Byte;
var Size: integer;
buffer: PBuffer;
infile, outfile: File;
SizeDone, SizeFile: Longint;
begin
if (InFileName<>OutFileName) then
begin
buffer := Nil;
AssignFile(infile,InFileName);
System.Reset(infile,1);
try
SizeFile:=FileSize(infile);
AssignFile(outfile, OutFileName);
System.Rewrite(outfile, 1);
try
SizeDone := 0;
New(Buffer);
repeat
BlockRead(infile, Buffer^, BufSize,Size);
Inc(SizeDone, Size);
BlockWrite(outfile,Buffer^, Size)
until Size<BufSize;
FileSetDate(TFileRec(outfile).Handle,
FileGetDate(TFileRec(infile).Handle));
finally
if Buffer<>Nil then Dispose(Buffer);
System.close(outfile)
end;
finally
System.close(infile);
end;
end else
Raise EInOutError.Create("File cannot be copied into itself");
end;


 
Giga-Byte   (2002-01-25 12:00) [2]

Достал на этом сайте:

procedure FastFileCopy(Const InfileName, OutFileName: String); Const BufSize = 3*4*4096; { 48Kbytes дает прекрасный результат }
Type PBuffer = ^TBuffer;
TBuffer = array [1..BufSize] of Byte;
var Size: integer;
buffer: PBuffer;
infile, outfile: File;
SizeDone, SizeFile: Longint;
begin
if (InFileName<>OutFileName) then
begin
buffer := Nil;
AssignFile(infile,InFileName);
System.Reset(infile,1);
try
SizeFile:=FileSize(infile);
AssignFile(outfile, OutFileName);
System.Rewrite(outfile, 1);
try
SizeDone := 0;
New(Buffer);
repeat
BlockRead(infile, Buffer^, BufSize,Size);
Inc(SizeDone, Size);
BlockWrite(outfile,Buffer^, Size)
until Size<BufSize;
FileSetDate(TFileRec(outfile).Handle,
FileGetDate(TFileRec(infile).Handle));
finally
if Buffer<>Nil then Dispose(Buffer);
System.close(outfile)
end;
finally
System.close(infile);
end;
end else
Raise EInOutError.Create("File cannot be copied into itself");
end;

Я ей фильмы/клипы копирую с компов



Страницы: 1 вся ветка

Форум: "Сети";
Текущий архив: 2002.04.08;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.005 c
14-22814
Alexander Vasjuk
2002-02-27 14:17
2002.04.08
Подключиться к 3Com хабу


3-22559
Mikeee
2002-03-14 09:49
2002.04.08
Общий титул на несколько колонок в DBGridEh


14-22823
AceR
2002-02-25 19:38
2002.04.08
Кодировка в Paradox


3-22586
Роман Василенко
2002-03-08 11:56
2002.04.08
Сохранение измененных посредством TQuery таблиц


3-22520
Андре
2002-03-01 15:29
2002.04.08
Select ... INTO ....





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский