On this page
  1. fputs
  2. Include
  3. Signature & Overview
  4. Notes & Pitfalls
  5. Example

fputs

Prev: fgets | Up: stdio.h | Next: fopen
Rel: stdio.h, stdio.h & File I/O Guide
Ref: cppreference — fputs
Tags: #public #prog #c #stdlib #stdio #tier/standard


Include

#include <stdio.h>

Signature & Overview

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

Writes a NUL-terminated string to stream without appending a newline (unlike puts).

Notes & Pitfalls

Example

#include <assert.h>
#include <stdio.h>

int main(void) {
    FILE *f = tmpfile();
    assert(fputs("raw line\n", f) != EOF);
    fclose(f);
}

Linked from

Related notes