Sign in Join
Wiki copytemporary

File/id: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: File/id

OldNewLine
1+Dalam artikel ini, demi kemudahan pengertian, [[reserved word/id|kata terpakai]] dalam Pascal ditampilkan dalam HURUF BESAR meskipun bahasa Pascal tidak sensitif jenis huruf.
2+
3+Ketikda dipakai dalam program [[Pascal]], **file** adalah variabel yang digunakan untuk mengambil data dengan membaca [[Variable|variabel]] file, atau untuk mengirimkan data ke variabel file, atau keduanya untuk pembacaan dan penulisan. File berbeda dari variabel normal dalam sebuah program dalam hal informasi di dalam file biasanya tersedia bahkan setelah program [[terminate/id|berakhir]].
4+
5+Format sumber Pascal adalah
6+
7+VAR filname : FILE;
8+
9+Di mana **filname** adalah variabel file yang dipakai untuk mengakses file. Kata _file_ sendiri merupakan [[reserved word/|kata terpakai]] dalam Pascal.
10+
11+When a file is defined in this fashion, it is called an _[[untyped]]_ file; it may be used to store essentially anything.
12+
13+A typical type of file used for plain documents is a **file of[[Char|char]]** and is defined by the compiler using the shorthand name [[Text|text]]. As such, the following two declarations should be equivalent:
14+
15+VAR filname : FILE OF char;
16+
17+VAR filname : text;
18+
19+In the above example, the [[Identifier|identifier]] used (_filname_) is the file [[Variable|variable]] which is used to do input, output, or both, to the actual file. The file variable, however, is not the actual file; the file variable must be tied to the actual file by a [[RTL|run-time library]] routine. In most cases, this is done via the [[assign]] procedure followed by use of the [[reset]] or [[rewrite]] procedure. In the case of specialized files such as databases, it is done via some other method than the standard ones, in order to allow a file variable to actually read from and/or write to the actual [[File|file]] itself using specialized routines.
20+
21+A file variable is used either for input, for output, or for both input and output (I/O). A file may be a screen and/or keyboard, a modem, a light pen, a touch screen, a mouse, an area of storage on disk, a socket for connecting to the Internet, or it could be some other device depending on how the run-time library ties the file. In some cases, actual memory can be defined as a file; this was used in the case of a ram disk.
22+
23+Some of these devices are connected through various specialized [[library|libraries]] instead of treating them as actual files. For example, databases are not normally accessed directly as a simple file which is read or written, they are usually accessed either through a set of database handling procedures and functions in an external unit or library, or are accessed via [[Glossary|SQL]] commands sent to a procedure or function. Programs that communicate with the Internet usually use a set of routines called [[Sockets|sockets]] under Unix-based operating systems, or using the [[Winsock]] routines on Microsoft Windows, which essentially provide the same functions as the Unix _sockets_ routines.
24+
25+Generally, the standard [[Pascal]] language does not distinguish between types of files, treating all files the same, allowing them to be accessed via the [[Read|read]], [[readln]], [[Write|write]] and [[writeln]] standard procedures. Some Pascal Compilers also used the [[Get]] and [[Put]] routines for I/O.
26+
27+Enhanced versions of Pascal such as [[UCSD Pascal]], [[Turbo Pascal]], and, of course, FPC Pascal have added features to indicate that a file is specifically a screen or a disk file, and to allow for such functions as naming of disk files, random access, appending to the end and deleting of files as needed.
28+
29+File-related types, procedures and functions:
30+
31+[[File]] \- [[Text]] \- [[AssignFile]] \- [[CloseFile]] \- [[Reset]] \- [[Rewrite]] \- [[Get]] \- [[Put]] \- [[Read]] \- [[Read|Readln]] \- [[Write]] \- [[Write|Writeln]]
32+
33+---
34+*From the Free Pascal wiki, page "File/id", as the Internet Archive kept it on 2020-10-22, last changed on 2015-07-22. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history