iscntrl

int iscntrl ( int c );
  • Check if character is a control character
  • 检查给定字符是否为控制字符,即编码 0x00-0x1F 及 0x7F 。

若 c 的值不能表示为 unsigned char 且不等于 EOF ,则行为未定义。

Parameters

c

  • Character to be checked, casted as an int, or EOF.
  • c - 要分类的字符

Return Value

  • A value different from zero (i.e., true) if indeed c is a control character. Zero (i.e., false) otherwise.
  • 若字符为控制字符则为非零,否则为零。

Example

//
// Created by zhangrongxiang on 2018/2/1 15:14
// File iscntrl
// #include <stdio.h>
#include <ctype.h>
#include <locale.h> int main() {
unsigned char c = '\x94'; // ISO-8859-1 的控制码 CCH
printf("In the default C locale, \\x94 is %sa control character\n",
iscntrl(c) ? "" : "not ");
//In the default C locale, \x94 is not a control character
setlocale(LC_ALL, "en_GB.iso88591");
printf("In ISO-8859-1 locale, \\x94 is %sa control character\n",
iscntrl(c) ? "" : "not "); int i = 0;
char str[] = "first line \n second line \n";
while (!iscntrl(str[i])) {
putchar(str[i]);
i++;
}
//first line
return 0;
}

## 文章参考
-
-

C 标准库 - ctype.h之iscntrl 使用的更多相关文章

  1. C 标准库 - ctype.h

    C 标准库 - ctype.h This header declares a set of functions to classify and transform individual charact ...

  2. C标准库<ctype.h>实现

    本文地址:http://www.cnblogs.com/archimedes/p/c-library-ctype.html,转载请注明源地址. 1.背景知识 ctype.h是C标准函数库中的头文件,定 ...

  3. C 标准库 - ctype.h之isalpha使用

    isalpha int isalpha ( int c ); Checks whether c is an alphabetic letter. 检查给定字符是否字母字符,即是大写字母( ABCDEF ...

  4. C 标准库 - ctype.h之isalnum使用

    isalnum int isalnum ( int c ); Checks whether c is either a decimal digit or an uppercase or lowerca ...

  5. C 标准库 - string.h

    C 标准库 - string.h This header file defines several functions to manipulate C strings and arrays. stri ...

  6. C 标准库 - <assert.h>

    C 标准库 - <assert.h> 简介 C 标准库的 assert.h头文件提供了一个名为 assert 的宏,它可用于验证程序做出的假设,并在假设为假时输出诊断消息. 已定义的宏 a ...

  7. C 标准库 - <stdarg.h>

    C 标准库 - <stdarg.h> 简介 stdarg.h 头文件定义了一个变量类型 va_list 和三个宏,这三个宏可用于在参数个数未知(即参数个数可变)时获取函数中的参数. 可变参 ...

  8. C 标准库 - <signal.h>

    C 标准库 - <signal.h> 简介 signal.h 头文件定义了一个变量类型 sig_atomic_t.两个函数调用和一些宏来处理程序执行期间报告的不同信号. 库变量 下面是头文 ...

  9. C 标准库 - <setjmp.h>

    C 标准库 - <setjmp.h> 简介 setjmp.h 头文件定义了宏 setjmp().函数 longjmp() 和变量类型 jmp_buf,该变量类型会绕过正常的函数调用和返回规 ...

随机推荐

  1. Android-ImageUtils工具类

    图片相关的工具类 public class ImageUtils { public static boolean saveImage(Bitmap photo, String spath) { try ...

  2. GPS模块输出的NMEA数据ddmm.mmmm转换成dd.ddddd并在google Earth Pro中描点

      GPS模块输出的数据是NMEA格式,其中GPGGA字段包含我们需要的经纬度信息. 例:$GPGGA,092204.999,4250.5589,S,14718.5084,E,1,04,24.4,12 ...

  3. [LeetCode 题解]: Rotate List

    Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1 ...

  4. 构建命令maven install 打包不是最新的代码

    问题: 之前一直用的是mvn install 命令来构建项目,但是最近发现最新的代码没有在war包中.之前看的说 mvn install 命令会执行之前的所有阶段,会被编译,测试,打包. 经查最后采用 ...

  5. 基于ASP.NET生成二维码详细源码

    详细链接:https://shop499704308.taobao.com/?spm=a1z38n.10677092.card.11.594c1debsAGeakusing System; using ...

  6. c# in out ref关键字

    class in_out_ref { #region in 关键字 delegate void DContravariant<in A>(A argumen); static void o ...

  7. 浅谈由管理者角色引出的B端产品设计思考点

    本文来自网易云社区 作者:任琼瑶 最近一直都在持续跟进云课堂B端的交互设计,在此期间,多多少少遇到了一些不曾遇到过的问题,虽然同是做产品设计,但B端和C端产品的确存在很多不同之处. 首先,当我们在做C ...

  8. “全栈2019”Java第九十九章:局部内部类与继承详解

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...

  9. oracle根据四位年周取当周周一的日期函数

    create or replace function FUNC_GET_DATE_BY_WEEK( theYearWeek IN VARCHAR2)return date is normalDate ...

  10. 抓包工具Fiddler使用教程

    一.基本原理 Fiddler 是以代理web服务器的形式工作的,它使用代理地址:127.0.0.1,端口:8888 二.Fiddler抓取https设置 1.启动Fiddler,打开菜单栏中的 Too ...