Skip to content

Instantly share code, notes, and snippets.

@dmilith
Created December 12, 2020 14:20
Show Gist options
  • Save dmilith/9b5f61b873feb2b532b0ed5295a24b72 to your computer and use it in GitHub Desktop.
Save dmilith/9b5f61b873feb2b532b0ed5295a24b72 to your computer and use it in GitHub Desktop.

Revisions

  1. dmilith created this gist Dec 12, 2020.
    11 changes: 11 additions & 0 deletions length.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    #include <stdio.h>
    #include <stddef.h>
    #include <wchar.h>
    #include <locale.h>

    int main () {
    setlocale(LC_ALL, "en_US.UTF-8");
    const wchar_t* wc = L"👌";
    int length = wcswidth(wc, 1);
    printf("%ls, length: %d\n", wc, length);
    }