End-of-file

In computing, end-of-file (EOF)[1] is a condition in a computer operating system where no more data can be read from a data source. The data source is usually called a file or stream.

Details

In the C standard library, the character reading functions such as getchar return a value equal to the symbolic value (macro) EOF to indicate that an end-of-file condition has occurred. The actual value of EOF is implementation-dependent and must be negative (but is commonly −1, such as in glibc[2]). Block-reading functions return the number of bytes read, and if this is fewer than asked for, then the end of file was reached or an error occurred (checking of errno or dedicated function, such as ferror is required to determine which).

EOF character

Input from a terminal never really "ends" (unless the device is disconnected), but it is useful to enter more than one "file" into a terminal, so a key sequence is reserved to indicate end of input. In UNIX the translation of the keystroke to EOF is performed by the terminal driver, so a program does not need to distinguish terminals from other input files. By default, the driver converts a Control-D character at the start of a line into an end-of-file indicator. To insert an actual Control-D (ASCII 04) character into the input stream, the user precedes it with a "quote" command character (usually Control-V). AmigaDOS is similar but uses Control-\ instead of Control-D.

In DOS and Windows (and in CP/M and many DEC operating systems such as the PDP-6 monitor,[3] RT-11, VMS or TOPS-10[4]), reading from the terminal will never produce an EOF. Instead, programs recognize that the source is a terminal (or other "character device") and interpret a given reserved character or sequence as an end-of-file indicator; most commonly this is an ASCII Control-Z, code 26. Some MS-DOS programs, including parts of the Microsoft MS-DOS shell (COMMAND.COM) and operating-system utility programs (such as EDLIN), treat a Control-Z in a text file as marking the end of meaningful data, and/or append a Control-Z to the end when writing a text file. This was done for two reasons:

  • Backward compatibility with CP/M. The CP/M file system (and also the original 8-bit FAT implemented in Microsoft BASIC) only recorded the lengths of files in multiples of 128-byte "records", so by convention a Control-Z character was used to mark the end of meaningful data if it ended in the middle of a record. The FAT12 filesystem introduced with 86-DOS and MS-DOS has always recorded the exact byte-length of files, so this was never necessary on DOS.
  • It allows programs to use the same code to read input from both a terminal and a text file.

In the ANSI X3.27-1969 magnetic tape standard, the end of file was indicated by a tape mark, which consisted of a gap of approximately 3.5 inches of tape followed by a single byte containing the character 13 (hex) for nine-track tapes and 17 (octal) for seven-track tapes.[5] The end-of-tape, commonly abbreviated as EOT, was indicated by two tape marks. This was the standard used, for example, on IBM 360. The reflective strip that was used to announce impending physical end of tape was also called an EOT marker.

See also

References

  1. ^ Pollock, Wayne. "Shell Here Document Overview". hccfl.edu. Archived from the original on 2014-05-29. Retrieved 2014-05-28.
  2. ^ "The GNU C Library". www.gnu.org.
  3. ^ "Table of IO Device Characteristics - Console or Teletypewriters". PDP-6 Multiprogramming System Manual (PDF). Maynard, Massachusetts, USA: Digital Equipment Corporation (DEC). 1965. p. 43. DEC-6-0-EX-SYS-UM-IP-PRE00. Archived (PDF) from the original on 2014-07-14. Retrieved 2014-07-10. (1+84+10 pages)
  4. ^ "5.1.1.1. Device Dependent Functions - Data Modes - Full-Duplex Software A(ASCII) and AL(ASCII Line)". PDP-10 Reference Handbook: Communicating with the Monitor - Time-Sharing Monitors (PDF). Vol. 3. Digital Equipment Corporation (DEC). 1969. pp. 5-3 – 5-6 [5-5 (431)]. Archived (PDF) from the original on 2011-11-15. Retrieved 2014-07-10. (207 pages)
  5. ^ "Tape Transfer (Pre-1977): Exchange Media: MARC 21 Specifications for Record Structure, Character Sets, and Exchange Media (Library of Congress)". www.loc.gov.

Read other articles:

Motorcycle shell Kawasaki Ninja ZX-12R full fairing A motorcycle fairing is a shell placed over the frame of a motorcycle, especially racing motorcycles and sport bikes, to deflect wind and reduce air drag. The secondary functions are the protection of the rider from airborne hazards and wind-induced hypothermia and of the engine components in the case of an accident. A motorcycle windshield will usually be integrated into the design of the fairing.[1] The major benefit of a fairing on s…

Artikel ini tidak memiliki referensi atau sumber tepercaya sehingga isinya tidak bisa dipastikan. Tolong bantu perbaiki artikel ini dengan menambahkan referensi yang layak. Tulisan tanpa sumber dapat dipertanyakan dan dihapus sewaktu-waktu.Cari sumber: Stadion Kuonoto – berita · surat kabar · buku · cendekiawan · JSTOR Stadion KuonotoLokasiLokasi Kabupaten Buol, Sulawesi TengahData teknisKapasitas8.000 penontonPemakaiPersbul BuolSunting kotak info …

1743 – MDCCXLIII281 år sedan År1740 | 1741 | 174217431744 | 1745 | 1746 Årtionde1720-talet  | 1730-talet 1740-talet1750-talet | 1760-talet Århundrade1600-talet 1700-talet1800-talet Årtusende1000-talet Året Födda | AvlidnaBildanden | Upplösningar Humaniora och kulturKonst, litteratur, musik och teater Samhällsvetenskapoch samhälleKrig Teknik och vetenskap Vetenskap Andra tideräkningar Gregorianska kal…

هذه المقالة عن المجموعة العرقية الأتراك وليس عن من يحملون جنسية الجمهورية التركية أتراكTürkler (بالتركية) التعداد الكليالتعداد 70~83 مليون نسمةمناطق الوجود المميزةالبلد  القائمة ... تركياألمانياسورياالعراقبلغارياالولايات المتحدةفرنساالمملكة المتحدةهولنداالنمساأسترالياب…

Großer PrielPemandangan Großer Priel dari HinterstoderTitik tertinggiKetinggian2.515 m (8.251 ft)[1]Puncak1.703 m (5.587 ft)Peringkat ke-25 di AlpenMasuk dalam daftarUltraKoordinat47°43′01″N 14°03′48″E / 47.71694°N 14.06333°E / 47.71694; 14.06333Koordinat: 47°43′01″N 14°03′48″E / 47.71694°N 14.06333°E / 47.71694; 14.06333 [1]GeografiLetakDistrik Gmunden, Austria HuluAustriaPegunung…

Questa voce o sezione sugli argomenti aziende di abbigliamento e aziende italiane non cita le fonti necessarie o quelle presenti sono insufficienti. Commento: totale assenza di fonti per affermazioni, nomi e sponsorizzazioni Puoi migliorare questa voce aggiungendo citazioni da fonti attendibili secondo le linee guida sull'uso delle fonti. Segui i suggerimenti del progetto di riferimento. EnnerreLogo Stato Italia Forma societariaSocietà a responsabilità limitata Fondazione1972 a P…

High school in Harrison, New York, United StatesHarrison High SchoolAddress255 Union AvenueHarrison, New York 10528United StatesCoordinates40°58′52″N 73°44′13″W / 40.98111°N 73.73694°W / 40.98111; -73.73694InformationSchool typePublic, high schoolSchool districtHarrison Central School DistrictPrincipalKimberly BeukemaTeaching staff111.15 (on an FTE basis) (2021–22)[1]Grades9–12[1]GenderCo-edEnrollment1,073 (2021–22)[1]Student to t…

Quadrennial mathematics conference International Congress of MathematiciansStatusActiveGenreMathematics conferenceFrequencyQuadrennialCountryVariesYears active1897–presentInaugurated9 August 1897; 126 years ago (1897-08-09)[1]FoundersFelix KleinGeorg CantorMost recent6–14 July 2022Previous event2022Next event22–29 July 2026ActivityActiveWebsitemathunion.org/icm The International Congress of Mathematicians (ICM) is the largest conference for the topic of mathematic…

المَسيحِيُّون χριστιανοί التعداد الكلي حوالي 2.4 مليار نسمة (2020)[1] مناطق الوجود المميزة  الاتحاد الأوروبي ‏ 373,656,000 [2]  الولايات المتحدة ‏ 246,790,000 [3]  البرازيل ‏ 175,770,000 [3]  المكسيك ‏ 107,780,000 [3]  روسيا ‏ 105,220,000 [3]  الفلبين ‏ 86,790,0…

Professional basketball league in Azerbaijan Basketball leagueAzerbaijan Basketball LeagueFounded1993; 31 years ago (1993)First season1993–94CountryAzerbaijanConfederationFIBA EuropeNumber of teams10Level on pyramid1Current championsSabah (1st title) (2022–23)Most championshipsNTD Baku (9 titles) 2023–24 Azerbaijan Basketball League The Azerbaijan Basketball League (Azerbaijani: Azərbaycan Basketbol Liqası) is the top men's professional basketball league in Azerbaijan.&…

الصاروخ جو-جو إيه جي إم-45 شرايك الأمريكي المضاد للرادار. صاروخ مضاد للإشعاعات (إنجليزية: (Anti-radiation missile - (ARM) هو صاروخ موجه يهدف لالتقاط وتدمير الأهداف التي تصدر انبعاثات على شكل موجات راديو.[1][2][3] تصمم هذه الصواريخ بشكل أساسي لتدمير رادارات العدو إلا أنه من الممكن أ…

Former lower house of the Swedish Riksdag (1866–1970) You can help expand this article with text translated from the corresponding article in Swedish. (March 2014) Click [show] for important translation instructions. View a machine-translated version of the Swedish article. Machine translation, like DeepL or Google Translate, is a useful starting point for translations, but translators must revise errors as necessary and confirm that the translation is accurate, rather than simply copy-pa…

  10000 metri piani femminiliRio de Janeiro 2016 Informazioni generaliLuogoStadio Nilton Santos Periodo12 agosto 2016 Partecipanti37 da 24 nazioni Podio Almaz Ayana  Etiopia Vivian Cheruiyot  Kenya Tirunesh Dibaba  Etiopia Edizione precedente e successiva Londra 2012 Tokyo 2020 Video ufficiale della Finale Voce principale: Atletica leggera femminile ai Giochi della XXXI Olimpiade. Atletica leggera aiGiochi olimpici diRio de Janeiro 2016 Corse piane 100 m piani   uomi…

This article is about the book publishing software. For the book type field of a DVD, see Book type. BooktypeDeveloper(s)SourcefabricInitial release14 February 2012 (2012-02-14)Stable release2.3 / 15 November 2017; 6 years ago (2017-11-15) Repositorygithub.com/booktype/Booktype Written inPythonOperating systemLinux, OS XAvailable inAlbanian, Catalan, English, Estonian, French, German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian, Portuguese, Punjabi, Ru…

Lineage of the Israelite king David House of David redirects here. For other uses, see House of David (disambiguation). House of Davidבית דוד‎Parent houseTribe of JudahCountryUnited Kingdom of Israel and JudahKingdom of JudahFounderDavid (traditional)Final rulerZedekiahTitlesKing of IsraelKing of JudahEstate(s)IsraelCadet branchesHouse of Solomon The Davidic line or House of David (Hebrew: בֵּית דָּוִד‎, romanized: Bēt Dāvīḏ) is the lineage of the Israelite kin…

American government official Caral Spangler17th Assistant Secretary of the Army(Financial Management and Comptroller)IncumbentAssumed office August 17, 2021PresidentJoe BidenSecretaryChristine WormuthPreceded byJohn E. Whitley Personal detailsBornCaral Elizabeth EricksonMankato, Minnesota, U.S.EducationMichigan State University (BA)Syracuse University (MPA) Caral Elizabeth Spangler (Cah-rall Span-gla) (née Erickson); is an American government official who has served as the Assistant Se…

وست هارفستراو     الإحداثيات 41°12′17″N 73°59′26″W / 41.2047°N 73.9906°W / 41.2047; -73.9906   [1] تاريخ التأسيس 1883  تقسيم إداري  البلد الولايات المتحدة[2]  التقسيم الأعلى مقاطعة روكلاند  خصائص جغرافية  المساحة 3.996437 كيلومتر مربع3.996438 كيلومتر مربع (1 أبريل 2010)&#…

Russian Imperial Army 33rd Infantry Division33-я пехотная дивизияActive1863–1918Country Russian EmpireBranch Russian Imperial ArmyRoleInfantrySizeapprox. 20,000[1]Garrison/HQKievMilitary unit The 33rd Infantry Division (Russian: 33-я пехотная дивизия, 33-ya Pekhotnaya Diviziya) was an infantry formation of the Russian Imperial Army. By the outbreak of World War I, it was part of the 21st Army Corps in the Kiev Military District.[2] It was or…

Cette liste présente les matchs de l'équipe du Mexique de football par adversaire rencontré. Sommaire : Haut – A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Sommaire Afrique du Sud • Algérie • Allemagne • Allemagne de l'Est (RDA) • Angleterre • Angola • Arabie saoudite • Argentine • Australie • Belgique • Bolivie • Brésil • Cameroun • Canada • Chili • Corée du Sud • Croatie • Danemark • Espagne • Égypte • États-Unis • Fidji • Franc…

Quaker magazine Friends JournalFriends Journal from December 2013CategoriesQuaker magazineFrequencyMonthlyCirculation6,510First issueOctober 13, 1827CompanyFriends Publishing CorporationCountryUnited StatesBased inPhiladelphiaWebsitewww.friendsjournal.orgISSN0016-1322 Friends Journal is a monthly Quaker magazine that combines first-person narrative, reportage, poetry, and news.[1] Friends Journal began publishing in 1827 and 1844 with the founding of The Friend (Orthodox, 1827—1955) an…