cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : C Library : cstdio (stdio.h) : puts
 
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
C Library
cassert (assert.h)
cctype (ctype.h)
cerrno (errno.h)
cfloat (float.h)
climits (limits.h)
clocale (locale.h)
cmath (math.h)
csetjmp (setjmp.h)
csignal (signal.h)
cstdarg (stdarg.h)
cstddef (stddef.h)
cstdio (stdio.h)
cstdlib (stdlib.h)
cstring (string.h)
ctime (time.h)
cstdio (stdio.h)
functions:
· clearerr
· fclose
· feof
· ferror
· fflush
· fgetc
· fgetpos
· fgets
· fopen
· fprintf
· fputc
· fputs
· fread
· freopen
· fscanf
· fseek
· fsetpos
· ftell
· fwrite
· getc
· getchar
· gets
· perror
· printf
· putc
· putchar
· puts
· remove
· rename
· rewind
· scanf
· setbuf
· setvbuf
· sprintf
· sscanf
· tmpfile
· tmpnam
· ungetc
· vfprintf
· vprintf
· vsprintf
macro constants:
· EOF
· FILENAME_MAX
· NULL
· TMP_MAX
objects:
· stderr
· stdin
· stdout
types:
· FILE
· fpos_t
· size_t

-

puts function
int puts ( const char * str );
<cstdio>

Write string to stdout

Writes the C string pointed by str to stdout and appends a newline character ('\n').
The function begins copying from the address specified (str) until it reaches the terminating null character ('\0'). This final null-character is not copied to stdout.
It is equivalent to fputs(str,stdout).

Parameters

str
C string to be written.

Return Value

On success, a non-negative value is returned.
On error, the function returns EOF.

Example

/* puts example : hello world! */
#include <stdio.h>

int main ()
{
  char string [] = "Hello world!";
  puts (string);
}

See also

fputs Write string to stream (function)
printf Print formatted data to stdout (function)
putchar Write character to stdout (function)
gets Get string from stdin (function)
© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us