You copied the Doc URL to your clipboard.

ISO-compliant C library input/output characteristics

The generic ARM C library has the following input/output characteristics:

  • The last line of a text stream does not require a terminating newline character.

  • Space characters written out to a text stream immediately before a newline character do appear when read back in.

  • No NUL characters are appended to a binary output stream.

  • The file position indicator of an append mode stream is initially placed at the end of the file.

  • A write to a text stream causes the associated file to be truncated beyond the point where the write occurred if this is the behavior of the device category of the file.

  • If semihosting is used, the maximum number of open files is limited by the available target memory.

  • A zero-length file exists, that is, where no characters have been written by an output stream.

  • A file can be opened many times for reading, but only once for writing or updating. A file cannot simultaneously be open for reading on one stream, and open for writing or updating on another.

  • Local time zones and Daylight Saving Time are not implemented. The values returned indicate that the information is not available. For example, the gmtime() function always returns NULL.

  • The status returned by exit() is the same value that was passed to it. For definitions of EXIT_SUCCESS and EXIT_FAILURE, see the header file stdlib.h. Semihosting, however, does not pass the status back to the execution environment.

  • The error messages returned by the strerror() function are identical to those given by the perror() function.

  • If the size of area requested is zero, calloc() and realloc() return NULL.

  • If the size of area requested is zero, malloc() returns a pointer to a zero-size block.

  • abort() closes all open files and deletes all temporary files.

  • fprintf() prints %p arguments in lowercase hexadecimal format as if a precision of 8 had been specified. If the variant form (%#p) is used, the number is preceded by the character @.

  • fscanf() treats %p arguments exactly the same as %x arguments.

  • fscanf() always treats the character "-" in a %...[...] argument as a literal character.

  • ftell(), fsetpos() and fgetpos() set errno to the value of EDOM on failure.

  • perror() generates the messages shown in Table 12.

Table 12. perror() messages
0No error (errno = 0)

EDOM - function argument out of range


ERANGE - function result not representable


ESIGNUM - illegal signal number


Unknown error

The following characteristics are unspecified in the ARM C library. They must be specified in an ISO-compliant implementation:

  • The validity of a filename.

  • Whether remove() can remove an open file.

  • The effect of calling the rename() function when the new name already exists.

  • The effect of calling getenv() (the default is to return NULL, no value available).

  • The effect of calling system().

  • The value returned by clock().