<?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%3ADisplayFileContentsProgram</id>
	<title>StartprogrammingusingObjectPascal:DisplayFileContentsProgram - 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%3ADisplayFileContentsProgram"/>
	<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=StartprogrammingusingObjectPascal:DisplayFileContentsProgram&amp;action=history"/>
	<updated>2026-05-01T07:47:37Z</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:DisplayFileContentsProgram&amp;diff=262&amp;oldid=prev</id>
		<title>Onionmixer: SPOP 파일내용보여주기프로그램 페이지 추가</title>
		<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=StartprogrammingusingObjectPascal:DisplayFileContentsProgram&amp;diff=262&amp;oldid=prev"/>
		<updated>2012-07-26T10:01:04Z</updated>

		<summary type="html">&lt;p&gt;SPOP 파일내용보여주기프로그램 페이지 추가&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;===파일 내용 보여주기 프로그램===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
Program ReadContents;&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;
    FileName: string;&lt;br /&gt;
    F: file;&lt;br /&gt;
    Block: array [0 .. 1023] of Byte;&lt;br /&gt;
    i, NumRead: Integer;&lt;br /&gt;
begin&lt;br /&gt;
    Write(&amp;#039;Input source file name: &amp;#039;);&lt;br /&gt;
    Readln(FileName);&lt;br /&gt;
&lt;br /&gt;
    if FileExists(FileName) then&lt;br /&gt;
    begin&lt;br /&gt;
        AssignFile(F, FileName);&lt;br /&gt;
&lt;br /&gt;
        FileMode:= 0;         // open for read only&lt;br /&gt;
        Reset(F, 1);&lt;br /&gt;
        while not Eof(F) do&lt;br /&gt;
        begin&lt;br /&gt;
            BlockRead(F, Block, SizeOf(Block), NumRead);&lt;br /&gt;
            // display contents in screen&lt;br /&gt;
            for i:= 0 to NumRead - 1 do&lt;br /&gt;
                Writeln(Block[i], &amp;#039;:&amp;#039;, Chr(Block[i]));&lt;br /&gt;
        end;&lt;br /&gt;
        CloseFile(F);&lt;br /&gt;
    end&lt;br /&gt;
    else // File does not exist&lt;br /&gt;
        Writeln(&amp;#039;Source File does not exist&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
    Write(&amp;#039;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;
이 예제를 실행하고 예제에 대하여 텍스트 파일 이름을 입력하고 나면, 처음에는 CR/LF 값 (13/10)을 보게 되는데, 제각각의 문자 코드 (ASCII)를 표시하기 때문입니다. 리눅스에서는 10진수로 10의 값을 갖는 라인 피드 (LF)만 보게 됩니다.&lt;br /&gt;
&lt;br /&gt;
그림이나, 실행파일과 같은 다른 형식의 파일도 내부가 어떻게 생겼는지 보기 위해 표시할 수 있습니다.&lt;br /&gt;
&lt;br /&gt;
이 예제에서 메모리에 97이라는 바이트 값으로 저장된 a 와 65라는 바이트 값으로 저장된 A와 같은 문자들의 숫자 값을 얻기 위해 &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Chr&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; 함수를 사용했습니다.&lt;br /&gt;
[[Category:StartprogrammingusingObjectPascal]]&lt;/div&gt;</summary>
		<author><name>Onionmixer</name></author>
	</entry>
</feed>