Dave's Brain

Browse - Programming Tips - The Microsoft Visual C++ isspace() assert when I give it a perfectly

Date: 2014dec15
Language: C/C++
Keywords: ISO 8859-1

Q.  The Microsoft Visual C++ isspace() assert when I give it a perfectly
good Latin1 character -- eg apostrophe.  How can I prevent this?

A.  You can write your own functions:

inline BOOL IsLatin1Space(const char c) { return c == ' ' || c >= 0x09 && c <= 0x0D; } inline BOOL IsLatin1Alpha(const char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } inline BOOL IsLatin1Digit(const char c) { return c >= '0' && c <= '9'; } inline BOOL IsLatin1Alnum(const char c) { return IsLatin1Alpha(c) || IsLatin1Digit(c); }

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.