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/