<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://trans.onionmixer.net/wiki/index.php?action=history&amp;feed=atom&amp;title=StartprogrammingusingObjectPascal%3ACopyFilesUsingFileOfByte</id>
	<title>StartprogrammingusingObjectPascal:CopyFilesUsingFileOfByte - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://trans.onionmixer.net/wiki/index.php?action=history&amp;feed=atom&amp;title=StartprogrammingusingObjectPascal%3ACopyFilesUsingFileOfByte"/>
	<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=StartprogrammingusingObjectPascal:CopyFilesUsingFileOfByte&amp;action=history"/>
	<updated>2026-05-01T07:47:03Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://trans.onionmixer.net/wiki/index.php?title=StartprogrammingusingObjectPascal:CopyFilesUsingFileOfByte&amp;diff=256&amp;oldid=prev</id>
		<title>Onionmixer: SPOP FileOfByte를사용하여파일복사하기 페이지 추가</title>
		<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=StartprogrammingusingObjectPascal:CopyFilesUsingFileOfByte&amp;diff=256&amp;oldid=prev"/>
		<updated>2012-07-26T09:57:26Z</updated>

		<summary type="html">&lt;p&gt;SPOP FileOfByte를사용하여파일복사하기 페이지 추가&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;===file of Byte를 사용하여 파일 복사하기===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
Program FilesCopy;&lt;br /&gt;
&lt;br /&gt;
{$mode objfpc}{$H+}&lt;br /&gt;
&lt;br /&gt;
uses&lt;br /&gt;
    {$IFDEF UNIX}{$IFDEF UseCThreads}&lt;br /&gt;
    cthreads,&lt;br /&gt;
    {$ENDIF}{$ENDIF}&lt;br /&gt;
    Classes, SysUtils&lt;br /&gt;
    { you can add units after this };&lt;br /&gt;
&lt;br /&gt;
var&lt;br /&gt;
    SourceName, DestName: string;&lt;br /&gt;
    SourceF, DestF: file of Byte;&lt;br /&gt;
    Block: Byte;&lt;br /&gt;
begin&lt;br /&gt;
    Writeln(&amp;#039;Files copy&amp;#039;);&lt;br /&gt;
    Write(&amp;#039;Input source file name: &amp;#039;);&lt;br /&gt;
    Readln(SourceName);&lt;br /&gt;
    Write(&amp;#039;Input destination file name: &amp;#039;);&lt;br /&gt;
    Readln(DestName);&lt;br /&gt;
    if FileExists(SourceName) then&lt;br /&gt;
    begin&lt;br /&gt;
        AssignFile(SourceF, SourceName);&lt;br /&gt;
        AssignFile(DestF, DestName);&lt;br /&gt;
&lt;br /&gt;
        FileMode:= 0;        // open for read only&lt;br /&gt;
&lt;br /&gt;
        Reset(SourceF); // open source file&lt;br /&gt;
        Rewrite(DestF); // Create destination file&lt;br /&gt;
&lt;br /&gt;
        // Start copy&lt;br /&gt;
        Writeln(&amp;#039;Copying..&amp;#039;);&lt;br /&gt;
        while not Eof(SourceF) do&lt;br /&gt;
        begin&lt;br /&gt;
            Read(SourceF, Block); // Read Byte from source file&lt;br /&gt;
            Write(DestF, Block); // Write this byte into new&lt;br /&gt;
                                                     // destination file&lt;br /&gt;
        end;&lt;br /&gt;
        CloseFile(SourceF);&lt;br /&gt;
        CloseFile(DestF);&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    else // Source File not found&lt;br /&gt;
        Writeln(&amp;#039;Source File does not exist&amp;#039;);&lt;br /&gt;
    Write(&amp;#039;Copy file is finished, press enter key to close..&amp;#039;);&lt;br /&gt;
    Readln;&lt;br /&gt;
end.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
앞의 예제를 실행하면, 기존의 파일 이름과 새 목적 파일 이름을 입력할 것입니다. 리눅스에서는 파일 이름들을 다음 처럼 입력할 수 있습니다.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Input source file name: /home/motaz/quran/mishari/32.mp3&lt;br /&gt;
Input destination file name: /home/motaz/Alsajda.mp3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
윈도우즈에서는 다음 처럼 입력할 수 있습니다.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Input source file name: c:\photos\mypphoto.jpg&lt;br /&gt;
Input destination file name: c:\temp\copy.jpg&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
만약 FileCopy 프로그램과 같은 디렉터리에 원본 파일이 있다면, 다음 처럼 파일 이름만 입력할 수 있습니다. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
Input source file name: test.pas&lt;br /&gt;
Input destination file name: testcopy.pas&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
큰 파일을 복사하기 위해 이 방법을 사용하면, 운영체제의 복사 프로시저와 비교해서 매우 많은 시간이 걸릴 것입니다. 이는 운영체제가 파일을 복사하기 위해 다른 기술을 사용한다는 것을 의미합니다. 만약 1메가바이트 파일을 복사하려 한다면, 1백만 번 while 순환문을 반복해야 한다는 것인데, 이는 곧 백만 번 읽고 백만 번 쓰는 동작을 수행한다는 것입니다. file of Byte를 file of Word 선언으로 대체하면, 읽기 쓰기를 500,000 번 수행하는 의미가 되지만, 파일 크기가 홀수가 아닌 짝수일 경우에만 동작할 것입니다. 만약 파일이 1,420 바이트를 가지고 있다면 잘 동작하겠지만, 1,423 바이트를 가지고 있다면 실패할 것입니다.&lt;br /&gt;
&lt;br /&gt;
더 빠른 방법으로 어떤 종류의 파일이든 복사하기 위해, &amp;#039;&amp;#039;비형식화 된 파일&amp;#039;&amp;#039;을 사용할 것입니다.&lt;br /&gt;
[[Category:StartprogrammingusingObjectPascal]]&lt;/div&gt;</summary>
		<author><name>Onionmixer</name></author>
	</entry>
</feed>