機能 |
出力ストリームへ文字列を出力することを表す。 |
||||
---|---|---|---|---|---|
定義 |
#include <stdio.h> int fputs ( const char * s, FILE * stream ); ※C99規格では以下の定義となる int fputs ( const char * restrict s, FILE * restrict stream ); |
||||
引数 |
|
||||
戻り値 |
成功した場合は、非負の値を返す。 エラーが発生した場合は、EOFを返す。 |
||||
実装例 |
#include <stdio.h> int main(void) { FILE *fp; fp = fopen("test.txt", "w"); if (NULL != fp) { fputs("Hello World.", fp); /* ファイルへ文字列を書き込む */ fclose(fp); } return 0; } |
||||
実行結果 |
(test.txtの内容) Hello World. |
fputs()