6.18.21 fputs Function

Puts a string to the stream.

Attention: This function is not implemented by MPLAB XC8 for PIC MCUs. It is implemented by all other compilers, but MPLAB XC8 for AVR MCUs has limited support of data streams.

Include

<stdio.h>

Prototype

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

Arguments

s
string to be written
stream
pointer to the open stream

Return Value

Returns a non-negative value if successful; otherwise, returns EOF.

Remarks

The function writes characters to the output stream up to but not including the null character.

Example

#include <stdio.h>

int main(void)
{
  char buf[] = "This is text\n";

  fputs(buf,stdout);
  fputs("|",stdout);
}

Example Output

This is text
|