C programming fputs stdio.h

In C programming the <stdio.h> fputs function writes the string to the specified stream without the null terminating character.The stream here can be file or console.The declaration of the function is given below.

int fputs(const char * restrict s,
FILE * restrict stream);

s -The string to write to stream.

stream -The stream to which the the string ‘s’ is to be written.

Return type
int -Returns EOF if a write error occurs;otherwise it returns a non negative value.

Note as stated earlier the null terminating character is not written to the stream.
Code example

char str[] = “Hello!!!” ;

int ret;

ret=fputs(str , stdout);

printf(“\nret=%d” , ret);



Related links

->C fputc stdio.h

->C puts stdio.h

->C fgets stdio.h

->C fopen stdio.h

->C fclose stdio.h