PDA

View Full Version : [C++] funzione puts()


StErMiNeiToR
17-09-2004, 18:27
nn ho msdn a casa... qualcuno puo spiegarmi questa funzione e magari farmi un esempio pratico?

anx721
18-09-2004, 02:30
Innanzitutto si trata di una funzione della libreria per l'I/O del C e non del C++; questa è la reference:

int puts (const char * string );

Output a string to stdout.
Copies the string to standard output stream (stdout) and appends a new line character (\n).


Parameters.

string
Null-terminated string to be outputed.
Return Value.
On success, a non-negative value is returned.
On error EOF value is returned.

Example.


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

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