Skip to content

๐Ÿ’จ Filter out a character out of String.

Feldwor edited this page Nov 13, 2021 · 1 revision

This is incomplete discussion on how to filter out a String.
Warning! The below implementation has a static buffer size which can cause buffer overflow.

#include <stdio.h>

int main()
{
    char buffer[32];

    printf("Type: ");
    scanf("%[a-zA-Z0-9_-.]",buffer);
    printf("Input: '%s'\n",buffer);

    return(0);
}