Write a string to stdout
#include <stdio.h> int puts( const char *buf );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The puts() function writes the character string pointed to by buf to the stdout stream, and appends a newline character to the output. The terminating NUL character of buf isn't written.
A nonnegative value for success, or EOF if an error occurs (errno is set).
#include <stdio.h> #include <stdlib.h> int main( void ) { FILE *fp; char buffer[80]; fp = freopen( "file", "r", stdin ); while( gets( buffer ) != NULL ) { puts( buffer ); } fclose( fp ); return EXIT_SUCCESS; }
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |