Einzelnen Beitrag anzeigen
Alt 10.10.2012, 02:00   #78
leecher
Moderator
C_EOF

E r g e b n i s / R e s u l t

The C_EOF function tests for end-of-file.

B e s c h r e i b u n g / D e s c r i p t i o n

The C_EOF function returns a nonzero value after the first read operation that attempts to read past the end of the file. It returns 0 if the current position is not end of file. There is no error return.

S y n t a x

Code:
res = call ('C_EOF' , fd)
P a r a m e t e r

fd - The file descriptor you obtained from C_OPEN

R e t u r n s

1 on end of file, 0 if not.

B e i s p i e l / E x a m p l e

Code:
attach 'FILE0'
attach 'FILE1'
! Create empty file
fd = CALL ("C_OPEN", "FILE.TXT", "w")
b = CALL("C_CLOSE", fd)

! Try to read from empty file
fd = CALL ("C_OPEN", "FILE.TXT", "r")
PUT CALL ("C_EOF", fd) ! Returns 1, as file has 0 bytes and we are at EOF
b = CALL("C_CLOSE", fd)
detach 'FILE0'
detach 'FILE1'
Angehängte Dateien
Dateityp: oac FILE1.OAC‎ (12.5 KB, 2x aufgerufen)
leecher ist offline   Mit Zitat antworten