C 标准库 - ctype.h之iscntrl 使用
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 使用的更多相关文章
- C 标准库 - ctype.h
C 标准库 - ctype.h This header declares a set of functions to classify and transform individual charact ...
- C标准库<ctype.h>实现
本文地址:http://www.cnblogs.com/archimedes/p/c-library-ctype.html,转载请注明源地址. 1.背景知识 ctype.h是C标准函数库中的头文件,定 ...
- C 标准库 - ctype.h之isalpha使用
isalpha int isalpha ( int c ); Checks whether c is an alphabetic letter. 检查给定字符是否字母字符,即是大写字母( ABCDEF ...
- C 标准库 - ctype.h之isalnum使用
isalnum int isalnum ( int c ); Checks whether c is either a decimal digit or an uppercase or lowerca ...
- C 标准库 - string.h
C 标准库 - string.h This header file defines several functions to manipulate C strings and arrays. stri ...
- C 标准库 - <assert.h>
C 标准库 - <assert.h> 简介 C 标准库的 assert.h头文件提供了一个名为 assert 的宏,它可用于验证程序做出的假设,并在假设为假时输出诊断消息. 已定义的宏 a ...
- C 标准库 - <stdarg.h>
C 标准库 - <stdarg.h> 简介 stdarg.h 头文件定义了一个变量类型 va_list 和三个宏,这三个宏可用于在参数个数未知(即参数个数可变)时获取函数中的参数. 可变参 ...
- C 标准库 - <signal.h>
C 标准库 - <signal.h> 简介 signal.h 头文件定义了一个变量类型 sig_atomic_t.两个函数调用和一些宏来处理程序执行期间报告的不同信号. 库变量 下面是头文 ...
- C 标准库 - <setjmp.h>
C 标准库 - <setjmp.h> 简介 setjmp.h 头文件定义了宏 setjmp().函数 longjmp() 和变量类型 jmp_buf,该变量类型会绕过正常的函数调用和返回规 ...
随机推荐
- [翻译]Writing Custom DB Engines 编写定制的DB引擎
Writing Custom DB Engines 编写定制的DB引擎 FastReport can build reports not only with data sourced from ...
- 好用的下拉第三方——nicespinner
1.简介 GitHub地址:https://github.com/arcadefire/nice-spinner Gradle中添加: allprojects { repositories { ... ...
- 使用python登录CNZZ访问量统计网站,然后获取相应的数据
思路: 第一步:使用pypeteer.launcher打开浏览器, 第二步:向CNZZ的登录(通过使用iframe嵌入的阿里巴巴单点登录页面),向iframe页面中自动输入用户名和密码,然后点击登录按 ...
- jenkins启动失败,提示Starting Jenkins Jenkins requires Java8 or later, but you are running 1.7.0
# 背景 centos安装jenkins后,先启动jenkins服务,结果报错如下: 但自己明明已经安装了java8的 # 解决方法 既然安装了java8的话,那么证明是jenkins启动的是还是用的 ...
- css+html+JQuery 万能弹出层,居中显示
function ShowMsg(str) {//要提示的文字 $(".payment_time_mask").remove(); $("body").appe ...
- QT的配置及目录结构
作者:一去丶二三里 来源:CSDN 原文:https://blog.csdn.net/liang19890820/article/details/51774724 注意:所有的配置中,/user中的/ ...
- MyBatis高级及其SSM框架搭建
代码生成器 首先meaven项目中导入支持包 <dependencies> <!-- https://mvnrepository.com/artifact/mysql/mysql-c ...
- SpringMVC框架 SpringMVC的获取01
---恢复内容开始--- SpringMVC通过实现MVC模式,很好地将数据.业务与展现进行了分离.从MVC的角度来说,SpringMVC和Struts2非常类似,但SpringMVC采用了可插拔的组 ...
- junit启动tomcat来进行单元测试
1.pom.xml配置下载需要的jar. <dependency> <groupId>junit</groupId> ...
- GPS坐标转百度地图坐标
百度地图提供了相关API:BMap.Convertor.translate, 但是使用上存在部分限制:1.次数限制:2.异步回调 可以用如下方法: /** * 地图位置计算工具(将GPS坐标转换成百度 ...