11.6.1.1522
FILE-SIZE
FILE
(
fileid
--
ud ior
)
ud
is the size, in characters, of the file identified by
fileid
.
ior
is the implementation-defined I/O result code. This operation does not affect the value returned by
FILE-
POSITION
.
ud
is undefined if
ior
is non-zero.
Testing:
:
cbuf buf bsize 0
FILL
;
:
fn2
S"
fatest2.txt"
;
VARIABLE
fid2
:
setpad
PAD
50 0
DO
I
OVER
C!
CHAR+
LOOP
DROP
;
setpad
Note:
If anything else is defined
setpad
must be called again as the pad may move
T{ fn2
R/W
BIN
CREATE-FILE
SWAP
fid2
!
-> 0 }T
T{
PAD
50 fid2
@
WRITE-FILE
fid2
@
FLUSH-FILE
-> 0 0 }T
T{ fid2
@
FILE-SIZE
-> 50. 0 }T
T{ 0. fid2
@
REPOSITION-FILE
-> 0 }T
T{ cbuf buf 29 fid2
@
READ-FILE
-> 29 0 }T
T{
PAD
29 buf 29
COMPARE
-> 0 }T
T{
PAD
30 buf 30
COMPARE
-> 1 }T
T{ cbuf buf 29 fid2
@
READ-FILE
-> 21 0 }T
T{
PAD
29
+
21 buf 21
COMPARE
-> 0 }T
T{ fid2
@
FILE-SIZE
DROP
fid2
@
FILE-POSITION
DROP
D=
-> <TRUE> }T
T{ buf 10 fid2
@
READ-FILE
-> 0 0 }T
T{ fid2
@
CLOSE-FILE
-> 0 }T
Forth 2012
Forth 2012
File-Access word set
Foreword
Proposals Process
200
x
Membership
Introduction
Terms, notation, and references
Usage requirements
Documentation requirements
Compliance and labeling
Glossary
Block word set
Double-Number word set
Exception word set
Facility word set
File-Access word set
Floating-Point word set
Locals word set
Memory-Allocation word set
Programming-Tools word set
Search-Order word set
String word set
Extended-Character word set
Rationale
Bibliography
Compatibility analysis
Portability guide
Reference Implementations
Test Suite
Alphabetic list of words
Glossary
Introduction
Additional terms
Additional usage requirements
Additional documentation requirements
Compliance and labeling
Glossary
FILE-SIZE
(
BIN
CLOSE-FILE
CREATE-FILE
DELETE-FILE
FILE-POSITION
FILE-SIZE
INCLUDE-FILE
INCLUDED
OPEN-FILE
R/O
R/W
READ-FILE
READ-LINE
REPOSITION-FILE
RESIZE-FILE
S"
SOURCE-ID
W/O
WRITE-FILE
WRITE-LINE
FILE-STATUS
FLUSH-FILE
INCLUDE
REFILL
RENAME-FILE
REQUIRE
REQUIRED
S\"