gtpc2m5i | C/C++ Language Support User's Guide |
This function writes a string to the standard output stream.
Format
#include <stdio.h> int puts(const char *string);
This function writes the string pointed to by string to the stream pointed to by stdout and appends the new-line character to the output. The terminating null character is not written.
Normal Return
Returns the number of bytes written.
Error Return
If an error occurs, puts returns EOF. If a system write error occurs, the write stops at the point of failure.
Programming Considerations
The puts function has the same restriction as any write operation for a read immediately following a write, or a write immediately following a read. Between a write and a subsequent read, there must be an intervening flush or reposition. Between a read and a subsequent write, there must be an intervening reposition unless an end-of-file (EOF) has been reached.
The TPF system does not support creating, updating, or deleting files in 1052 or UTIL state. Special files may or may not be writable in 1052 or UTIL state depending on the device driver implementation.
TARGET(TPF) restrictions |
---|
|
Examples
The following example writes 'Hello World' to stdout.
#include <stdio.h> int main(void) { if ( puts("Hello World") == EOF ) printf( "Error in puts\n" ); }
Output
Hello World
Related Information