Is it possible to read alphanumeric characters only from the given input line ignoring everything else in C/C++? I am trying to read whole line at a time.
Suppose we have to read the line:
aaa, bbb, ccc .
Here, my intention is to ignore comma, dot and space while taking input.
You can do this in several ways, for example the simplest is to read the whole line and then remove the bits you don’t want later:
Reads a line and then removes any characters which return false for
isalnum. (In C++11 you can simplify this slightly)