How can we remove all leading and trailing <SPACE>, <TAB>, and <CR> characters from a character of string. I think I can use strtrim but can anyone explain me with the help of an example.

See this at MSDN. Aside from their void main(argh) you can probably adopt the example they have there (you can leave the TCHAR in as it resolves to the type of the character set under which you are compiling, e.g. char for ASCII). Just make a string of all the chars you want to strip out (so in your case it would look like " \t\n".
You have to include that header (shlwapi) which is only in Visual Studio I believe.
For alternatives see something like this but read the comments under each one to get the limitations of each. They go by order of popularity but I think the second one may be better, IMO.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.