Previous mail
Next mail
Unformatted/full headers
Overview 10 days
Subject
Date
Thread
Author
From: Tom Schneider
Subject: EOF is not true on reset empty file
Date: 31 Jan 2005, 19:53:57
Maurice:
> Still please do the cross check. I have no Sun at hand do do it,
> and may be nobody in this list has exactly the same system.
> I know nothing on the inners of the Sun file system, whether
> it stores somewhere the fact that this is a binary or a text file,
> if the file length is obtained by looking truly to the file content,
> or to some information on the length stored somewhere outside of the
> file, etc. In DOS systems when running scandisk, you find sometimes
> an error message like "file length as reported by the system is different
> from the true file length"
Ok.
closetest.p: In main program:
closetest.p:20: error: undeclared identifier `close' (first use in this routine)
closetest.p:20: error: (Each undeclared identifier is reported only once
closetest.p:20: error: for each routine it appears in.)
The function 'close' is not standard Pascal. Since I'm not set up to
avoid standard Pascal (and I don't think it is critical, correct me if
I'm wrong please), remove those lines. A rewrite followed by a reset
empties the file.
********************************************************************************
strawberry 21% more closetest.p
program closetest(namebook, namelist, output);
(*
Dr. Thomas D. Schneider
National Cancer Institute
Laboratory of Experimental and Computational Biology
Molecular Information Theory Group
Frederick, Maryland 21702-1201
toms@ncifcrf.gov
permanent email: toms@alum.mit.edu (use only if first address fails)
http://www.lecb.ncifcrf.gov/~toms/
*)
const
version = 1.00; (* of closetest.p 2005 jan 31 *)
var
namebook, namelist: text;
begin
rewrite(namebook);
{
close(namebook);
}
reset(namebook);
if eof(namebook)
then writeln(output,'eof of namebook')
else writeln(output,'NOT eof of namebook');
rewrite(namelist);
{
close(namelist);
}
reset(namelist);
if eof(namelist)
then writeln(output,'eof of namelist')
else writeln(output,'NOT eof of namelist');
end.
********************************************************************************
NOT eof of namebook
NOT eof of namelist
The program failed.
strawberry 15% ls -l nam*
-rw------- 1 toms delila 0 Jan 31 19:40 namebook
-rw------- 1 toms delila 0 Jan 31 19:40 namelist
strawberry 16% wc nam*
0 0 0 namebook
0 0 0 namelist
0 0 0 total
strawberry 17% file nam*
namebook: empty file
namelist: empty file
The files made by the Pascal program are indeed empty by these three
tests.
Regards,
Tom
Dr. Thomas D. Schneider
National Cancer Institute
Laboratory of Experimental and Computational Biology
Molecular Information Theory Group
Frederick, Maryland 21702-1201
toms@ncifcrf.gov
permanent email: toms@alum.mit.edu (use only if first address fails)
http://www.lecb.ncifcrf.gov/~toms/
Previous mail
Next mail
Unformatted/full headers
Overview 10 days
Subject
Date
Thread
Author
Note: This page contains information that does not originate from the owner of this web site, but from the authors of the mails archived. The owner of this web site is not responsible for the content of such information. Any use of that infomation requires the consent of the respective author.
Where WWW addresses (URLs) in the mails archived are marked as hyperlinks, this is only for the comfort of the reader. The content of the web pages linked to like this does not necessarily reflect the opinion of the owner of this web site or of the authors of the mails archived. The owner of this web site is not responsible for the content of such web pages. Those pages are explicitly not to be considered as part of the content of this page, but merely as references.
This page was created by Crystal 0.999 (Linux 2.4.27/i686).