iswprint Function

Test for a printable wide character (includes a wide space).

Attention: This function is implemented only by MPLAB XC32 C compilers.

Include

<wctype.h>

Prototype

int iswprint(wint_t wc);

Argument

wc
The wide character to test.

Return Value

Returns a non-zero integer value if the wide character, wc, is printable; otherwise, returns a zero.

Remarks

A printable wide character occupies at least one printing position on a display when printed.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

#include <wctype.h>
#include <stdio.h>
#include <stdbool.h>

int main(void)
{
  wint_t wStr[] = L"A string, 2 wide 4 some.\n";
  wint_t wc;
  unsigned idx = 0;
  bool found = false;

  do {
    wc = wStr[idx];
    if(iswprint(wc)) {
      if( ! found)
        printf("Found matching wide char at position: ");
      printf("%s%u", found ? ", " : "", idx);
      found = true;
    }
    idx++;
  } while(wStr[idx]);
  printf("\n");
}

Example Output

Found matching wide char at position: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23