Re: EOF location?



Thanks Michael,

A very concise and accurate summation of the points discussed.

Pete.

TOP POST nothing new below...

"Michael Mattias" <michael.mattias@xxxxxxx> wrote in message
news:3gieg.714$VE1.70@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"Roger While" <simrw@xxxxxxxxxxxx> wrote in message
news:e5c8aa$8k6$00$1@xxxxxxxxxxxxxxxxxxxx
Sorry PD, CR/LF has never, and will never indicate EOF.
CR/LF indicates end-of-line (EOL)(in a text file); period.
The extra end-of-file (EOF) byte comes from MSDOS which indeed
inserted an ASCII 26 (control-z) at end of file.
Modern windows "command window" do NOT insert
this EOF anymore although they will read/interpret it.

We seem to have reached a point where the difference between the
computer's
operating system and the application has become blurred.

What characters are written to disk, and how they are read back, is a
function of the application which writes or reads. The Windows and its
predecessor MS-DOS operating systems are totally ignorant of any special
meanings for any character.

"By convention" CRLF means "end of record when the application considers
the
file a text file" and this convention is respected by all applications
which
consider themselves "text editor/viewer" applications. (FWIW, the
definition
of a "text" file as a "collection of carriage-return-line-feed delimited
logical records" is about as universal a definition as exists).

Also "by convention" a "text file" is terminated by Ctrl-Z (0x1A), but
this
is nowhere near as widely recognized; or more accurately, is no longer as
widely recognized as it used to be.

Type at a prompt "1,2,3,4,5,6,<enter>?" The application reading the
keystrokes (in this case the command shell) arbitrarily decides that
<Enter>
means "add CR LF to the file".

Need 0x1A? Type 1,2,3,4,5,6,<Ctrl-z> using the same application, the
command shell - you got it. Type <Ctrl-z> in another 'text editor'
application such as Notepad - you get nada; or maybe a beep; or maybe "The
quick brown fox jumped over the lazy white dog <CRLF>." Hit the "F6"
key?
The command shell application decides this means "append a single 0x1A to
the file."

Bottom line is, on the MS-DOS and WIndows operating systems all files are
but a stream of bytes; there are no end-of-record markers, there is no
end-of-file marker; all characaters stored in the file are equally
considered valid 'data' characters. (Not necessarily true of other
operating
systems.).

Only by understanding this and your application requirements can you
select
the proper COBOL tool for the task at hand.. shall I use what my compiler
application calls a LINE SEQUENTIAL file organization? Or shall I treat
the
file as a stream of bytes and locate the logical records myself by finding
the CRLF (or other record-delimiting ) characters? And what should my
application do if it finds a byte which is a 0x1A character?

Yes, Ye Olde Bane of 'application-specific' strikes again!


MCM













.



Relevant Pages

  • Re: Unusual Input with fgets( )
    ... I assume you mean end-of-file, not the characters 'E', 'O', 'F'. ... EOF can't. ... It's hard to tell why your program halts, ...
    (comp.lang.c)
  • Re: AuthorTools in Mathematica: Dont omit the .nb suffix
    ... used by significant numbers of "ordinary users", or operating systems ... handful of illegal characters or arrangements of characters that somehow ... have a special meaning not to the OS but to the file system on which the ... reading the last several characters of the file name. ...
    (comp.sys.mac.apps)
  • Characters Forbidden in File Names
    ... For the purpose of enabling a Perl module, currently in development, to ... Which characters are forbidden in filenames on Windows, ... Which of these operating systems have limitations on the length of ...
    (comp.lang.perl.modules)
  • Re: extract all hotmail email addresses in a file and store in separate file
    ... Strip out the " characters and just leave the email addresses on ... When a read error occurs (i.e., fgets returns NULL and ferror is true) ... In the case of end-of-file ... the array contents are left unchanged. ...
    (comp.lang.c)
  • Re: Get_Line problem (GNAT bug?)
    ... but crippled operating systems like Windows and Unix. ... The concept of a sequence of characters is OK, but it is not text I/O. ... only one OS and only one presentation format. ...
    (comp.lang.ada)