Table of Contents

isascii

    int isascii(int char);

a macro that tests if a char a ASCII char (0-127) is

cpp Sourcecode Example

/* 
 * isascii example code
 * http://code-reference.com/cpp/cctype/isascii 
 */
#include <iostream> /* including standard library */
#include <string> 
#include <cctype>
 
using namespace std;
int main ( void )
{
  int i;
  string str="Test ÖÄ%1";
  for (i=0; i <= 11;i++)
    {
     if ( isascii(str) != 0 )
      {
       cout << "character" << i << " isascii" << endl;
      }
    }
  return 0;
}

output

  output:
  character 0 isascii
  character 1 isascii
  character 2 isascii
  character 3 isascii
  character 4 isascii
  character 9 isascii
  character 10 isascii
  character 11 isascii