toascii

提供: RAD Studio
移動先: 案内検索

ctype.h:インデックス への移動


ヘッダー ファイル

ctype.h

カテゴリ

変換ルーチン

プロトタイプ

int toascii(int c);

説明

文字を ASCII 形式に変換します。

toascii は、下位 7 ビット以外のすべてのビットをクリアすることで整数 c を ASCII 形式に変換するマクロです。変換結果は 0 ~ 127 の範囲の値になります。

戻り値

toascii は、c を変換した値を返します。


#include <ctype.h>
char* asciify(char* input)
{
  while (*input)
  {
    *input = toascii(*input);
    input++;
  }

  return input;
}

移植性

POSIX Win32 ANSI C ANSI C++

+