This shows you the differences between two versions of the page.
c:stdio.h:puts [2013/01/22 22:02] |
c:stdio.h:puts [2024/02/16 01:05] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{keywords>wiki library source code example reference}} | ||
+ | ===== puts ====== | ||
+ | <code c> | ||
+ | int puts(const char *str); | ||
+ | </code> | ||
+ | |||
+ | Writes str (excluding terminating NUL) and a newline to stdout. Returns non-negative on success, EOF on error. | ||
+ | |||
+ | ===== Example Source ===== | ||
+ | <code c> | ||
+ | /* | ||
+ | * puts example code | ||
+ | * http://code-reference.com/c/stdio.h/puts | ||
+ | */ | ||
+ | |||
+ | #include <stdio.h> /* including standard library */ | ||
+ | //#include <windows.h> /* uncomment this for Windows */ | ||
+ | |||
+ | |||
+ | int main ( void ) | ||
+ | { | ||
+ | char string [30] = "This is a test for puts!"; | ||
+ | puts (string); | ||
+ | return 0; | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | ==== output ==== | ||
+ | ./puts | ||
+ | This is a test for puts! | ||
+ | |||