fputwc_unlocked - Linux


Overview

fputwc_unlocked writes a wide character to a stream. This function is similar to fputc_unlocked except that it operates on wide character streams.

Syntax

int fputwc_unlocked(wchar_t wc, FILE *stream);

Options/Flags

None.

Examples

Write the wide character L'a' to a stream:

#include <stdio.h>

int main()
{
  FILE *stream = fopen("file.txt", "w");
  fputwc_unlocked(L'a', stream);
  fclose(stream);
  return 0;
}

Common Issues

If the stream is not open for writing, fputwc_unlocked will fail and return EOF.

Integration

fputwc_unlocked can be used with other file manipulation commands such as fopen, fwrite, and fclose to write wide character data to files.

Related Commands

  • fputc_unlocked
  • fputc
  • fputws