Interpretations

Answering questions that may arise related to the meaning of portions of an IEEE standard concerning specific applications.

IEEE Standards Interpretation for IEEE Std 1003.1™-2001 IEEE Standard Standard for Information Technology -- Portable Operating System Interface (POSIX®)

Copyright © 2006 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.

Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.

IEEE Standards Department Copyrights and Permissions 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA

Interpretation Request #51
Topic: fgetc, fgetwc, fgets, fgetws, gets Relevant Sections: XSH fgetc, fgetwc, fgets, fgetws, gets Page: 372 Line: 12048, Page: 378 Line: 12222, Page: 376 Line: 12166, Page: 380 Line: 12295, Page: 568 Line: 18675

The fgetc(), fgets() descriptions should not list the wide character functions in the text below.
The fgetwc() and fgetws() descriptions should be similar to their non-wide counterparts. gets() should have similar wording to fgetc().

fgetc() description states (p372 l12048):
"The fgetc() function may mark the st_atime field of the file associated with stream for update. The st_atime field shall be marked for update by the first successful execution of fgetc(), fgets(), fgetwc(), fgetws(), fread(), fscanf(), getc(), getchar(), gets(), or scanf() using stream that returns data not supplied by a prior call to ungetc() or ungetwc()."

fgetwc(): pg 378, line 12222 states:
"If the stream is at end-of-file, the end-of-file indicator for the stream shall be set and fgetwc() shall return WEOF."

fgets() description states (p376 l12166):
"The fgets() function may mark the st_atime field of the file associated with stream for update. The st_atime field shall be marked for update by the first successful execution of fgetc(), fgets(), fgetwc(), fgetws(), fread(), fscanf(), getc(), getchar(), gets(), or scanf() using stream that returns data not supplied by a prior call to ungetc() or ungetwc()."

fgetws(): pg 380, line 12295 states:
"If the stream is at end-of-file, the end-of-file indicator for the stream shall be set and fgetws() shall return a null pointer."

gets(): pg 568, line 18675 states:
"If the stream is at end-of-file, the end-of-file indicator for the stream shall be set and gets() shall return a null pointer."

Action:
The fgetc() description should not list the wide character functions, ie:
"The fgetc() function may mark the st_atime field of the file associated with stream for update. The st_atime field shall be marked for update by the first successful execution of fgetc(), fgets(), fread(), fscanf(), getc(), getchar(), gets(), or scanf() using stream that returns data not supplied by a prior call to ungetc()."

For fgetwc():
It should be similiar to fgetc() behavior, ie: it should state:
"If the end-of-file indicator for the stream is set, or if the stream is a end-of-file, the end-of-file indicator for the stream shall be set and fgetwc() shall return WEOF.

The fgets() description should not list the wide character functions, ie:
It should be similiar to fgetc() behavior, ie: it should state:
"If the end-of-file indicator for the stream is set, or if the stream is a end-of-file, the end-of-file indicator for the stream shall be set and fgetws() shall return a null pointer."

gets():
It should be similiar to fgetc() behavior, ie: it should state:
"If the end-of-file indicator for the stream is set, or if the stream is a end-of-file, the end-of-file indicator for the stream shall be set and gets() shall return a null pointer."

Interpretation Response #51
The standards states the requirements for fgetc(), fgetwc(), fgets(), fgetws(), and gets(), and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Rationale for Interpretation
None.