当前位置: 首页 > news >正文

网站网格布局排名优化seo公司

网站网格布局,排名优化seo公司,日本软银是干什么的,推广网站排名❤个人主页:折枝寄北的博客 ❤专栏位置:简单入手C语言专栏 目录 前言1. 错误信息报告1.1 strerror 2. 字符操作2.1 字符分类函数2.2 字符转换函数 3. 内存操作函数3.1 memcpy3.2 memmove3.2memset3.3 memcmp 感谢您的阅读 前言 当你写下strcpy(dest, s…

折枝寄北主页图
❤个人主页:折枝寄北的博客
❤专栏位置:简单入手C语言专栏

目录

  • 前言
  • 1. 错误信息报告
    • 1.1 strerror
  • 2. 字符操作
    • 2.1 字符分类函数
    • 2.2 字符转换函数
  • 3. 内存操作函数
    • 3.1 memcpy
    • 3.2 memmove
    • 3.2memset
    • 3.3 memcmp
  • 感谢您的阅读

前言

当你写下strcpy(dest, src)这行看似无害的代码时,是否意识到自己正在操作系统的血管里进行一场没有安全绳的高空走钢丝?在C语言的世界里,字符串从来都不是温顺的数据羔羊,而是戴着可爱面具的"内存刺客"——那些优雅的str开头的函数库,既是程序员最亲密的工具,也是引发段错误(Segmentation Fault)的经典元凶。

1. 错误信息报告

1.1 strerror

标准格式:

char * strerror ( int errnum );

功能:

获得指向错误信息的地址 C语言的库函数在运行的时候,如果发生错误,就会将错误存在一个变量中,这个(全局)变量是:errno
错误码是一些数字:1,2,4,5。。。 我们需要将错误码翻译成错误信息

代码示例部分:
示例一

#include <stdio.h>
#include <string.h>
#include <errno.h>//必须包含的头文件
int main ()
{FILE * pFile;pFile = fopen ("unexist.ent","r");if (pFile == NULL)printf ("Error opening file unexist.ent: %s\n",strerror(errno));//errno: Last error numberreturn 0;
}

示例二

int main()
{printf("%s\n", strerror(0));printf("%s\n", strerror(1));printf("%s\n", strerror(2));printf("%s\n", strerror(3));printf("%s\n", strerror(4));printf("%s\n", strerror(5));return 0;
}#include<errno.h>
int main()
{//打开文件FILE* pf = fopen("test.txt", "r");if (pf == NULL){printf("%s\n",strerror(errno));//perror  打印错误信息//在打印错误信息前,会先打印自定义的信息perror("fopen");//printf("文件打开失败\n");return 1;}else{printf("文件打开成功\n");}//关闭文件fclose(pf);return 0;//如果文件打开成功,会返回一个有效的指针//打开失败,返回一个NULL指针
}

2. 字符操作

简单列举出部分字符操作函数,供大家自行学习。(全写出来篇幅过长,不易阅读)

2.1 字符分类函数

函数 --------如果他的参数符合下列条件就返回真
1.iscntrl----- 任何控制字符
2.isspace -----空白字符:空格‘ ’,换页‘\f’,换行’\n’,回车‘\r’,制表符’\t’或者垂直制表符’\v’
3.isdigit---- 十进制数字 0~9
4.isxdigit ----十六进制数字,包括所有十进制数字,小写字母a-f,大写字母A~F
5.islower---- 小写字母a~z
6.isupper ----大写字母A~Z
7.isalpha ----字母a-z或A~Z
8.isalnum ----字母或者数字,a-z,A-Z,0~9
9.ispunct ----标点符号,任何不属于数字或者字母的图形字符(可打印)
10.isgraph ----任何图形字符
11.isprint ----任何可打印字符,包括图形字符和空白字符

2.2 字符转换函数

int tolower ( int c );
int toupper ( int c );

代码示例:

字符转换
eg:I Have Apple.
int main()
{char arr[] = "I Have Apple.";int i = 0;while (arr[i]){if (isupper(arr[i])){arr[i] = tolower(arr[i]);}printf("%c", arr[i]);i++;}return 0;
}

3. 内存操作函数

3.1 memcpy

标准格式:

void * memcpy ( void * destination, const void * source, size_t num );

功能:

strcpy只能拷贝字符串
memcpy可以拷贝其他类型的数据

注意:

  • 函数memcpy从source的位置开始向后复制num个字节的数据到destination的内存位置。
  • 这个函数在遇到 ‘\0’ 的时候并不会停下来。
  • 如果source和destination有任何的重叠,复制的结果都是未定义的。
    代码示例部分:
#include <stdio.h>
#include <string.h>
struct{char name[40];int age;
} person, person_copy;
int main ()
{char myname[] = "Pierre de Fermat";/* using memcpy to copy string: */memcpy ( person.name, myname, strlen(myname)+1 );person.age = 46;/* using memcpy to copy structure: */memcpy ( &person_copy, &person, sizeof(person) );printf ("person_copy: %s, %d \n", person_copy.name, person_copy.age );return 0;
}

3.2 memmove

标准格式:

void * memmove ( void* destination, const void * source, size_t num );

功能及注意:

1.和memcpy的差别就是memmove函数处理的源内存块和目标内存块是可以重叠的。
2.如果源空间和目标空间出现重叠,就得使用memmove函数处理。

代码示例部分:

include <stdio.h>
#include <string.h>
int main ()
{char str[] = "memmove can be very useful......";memmove (str+20,str+15,11);puts (str);return 0;
}

3.2memset

功能:

以字节为单位来设置内存中的数据

代码示例部分:

int main()
{char arr[] = "hello world";memset(arr, 'x', 5);printf("%s\n", arr);memset(arr+6, 'y', 5);printf("%s\n", arr);return 0;
}

3.3 memcmp

标准格式:

int memcmp ( const void * ptr1, const void * ptr2, size_t num );

功能:

比较从ptr1和ptr2指针开始的num个字节

代码示例部分:

#include <stdio.h>
#include <string.h>
int main ()
{char buffer1[] = "DWgaOtP12df0";char buffer2[] = "DWGAOTP12DF0";int n;n=memcmp ( buffer1, buffer2, sizeof(buffer1) );if (n>0) printf ("'%s' is greater than '%s'.\n",buffer1,buffer2);else if (n<0) printf ("'%s' is less than '%s'.\n",buffer1,buffer2);else printf ("'%s' is the same as '%s'.\n",buffer1,buffer2);return 0;
}

感谢您的阅读


文章转载自:
http://write.xhqr.cn
http://hesione.xhqr.cn
http://filtre.xhqr.cn
http://galleyworm.xhqr.cn
http://rachis.xhqr.cn
http://kopje.xhqr.cn
http://summertime.xhqr.cn
http://plage.xhqr.cn
http://hereditism.xhqr.cn
http://unspoke.xhqr.cn
http://ramp.xhqr.cn
http://rheotropism.xhqr.cn
http://accelerometer.xhqr.cn
http://keelung.xhqr.cn
http://retinocerebral.xhqr.cn
http://israeli.xhqr.cn
http://spare.xhqr.cn
http://homebuilt.xhqr.cn
http://sunfish.xhqr.cn
http://bunyan.xhqr.cn
http://utilise.xhqr.cn
http://misdeed.xhqr.cn
http://sachet.xhqr.cn
http://clypeated.xhqr.cn
http://evenhanded.xhqr.cn
http://timekeeper.xhqr.cn
http://linkswoman.xhqr.cn
http://hygrology.xhqr.cn
http://raf.xhqr.cn
http://backgrounder.xhqr.cn
http://exanthemate.xhqr.cn
http://appellation.xhqr.cn
http://discoidal.xhqr.cn
http://aileen.xhqr.cn
http://drowse.xhqr.cn
http://christianization.xhqr.cn
http://droplight.xhqr.cn
http://demi.xhqr.cn
http://modernminded.xhqr.cn
http://meridian.xhqr.cn
http://reptilian.xhqr.cn
http://louvred.xhqr.cn
http://chaldea.xhqr.cn
http://agress.xhqr.cn
http://dodecahedral.xhqr.cn
http://gunlock.xhqr.cn
http://descensive.xhqr.cn
http://prius.xhqr.cn
http://resemble.xhqr.cn
http://councilman.xhqr.cn
http://kasher.xhqr.cn
http://konstanz.xhqr.cn
http://scythian.xhqr.cn
http://quintuplet.xhqr.cn
http://lythraceous.xhqr.cn
http://epithetical.xhqr.cn
http://manyat.xhqr.cn
http://pique.xhqr.cn
http://accepter.xhqr.cn
http://makah.xhqr.cn
http://unfortunate.xhqr.cn
http://tuner.xhqr.cn
http://confide.xhqr.cn
http://supernutrition.xhqr.cn
http://diluvium.xhqr.cn
http://consecrate.xhqr.cn
http://boysenberry.xhqr.cn
http://airfreighter.xhqr.cn
http://desmosome.xhqr.cn
http://agi.xhqr.cn
http://rubbed.xhqr.cn
http://mediad.xhqr.cn
http://doctrinairism.xhqr.cn
http://desperateness.xhqr.cn
http://amphineura.xhqr.cn
http://humouristic.xhqr.cn
http://furzy.xhqr.cn
http://tautomer.xhqr.cn
http://backside.xhqr.cn
http://microcosmos.xhqr.cn
http://unmistakably.xhqr.cn
http://fingerling.xhqr.cn
http://exfiltrate.xhqr.cn
http://exemplariness.xhqr.cn
http://mephitis.xhqr.cn
http://fovea.xhqr.cn
http://deconcentrate.xhqr.cn
http://abdominous.xhqr.cn
http://hesitantly.xhqr.cn
http://intercollege.xhqr.cn
http://chauffer.xhqr.cn
http://macroprocessor.xhqr.cn
http://gynobase.xhqr.cn
http://fistula.xhqr.cn
http://supermaxilla.xhqr.cn
http://podophyllum.xhqr.cn
http://demonologically.xhqr.cn
http://hexaemeric.xhqr.cn
http://burgomaster.xhqr.cn
http://interfoliaceous.xhqr.cn
http://www.15wanjia.com/news/83023.html

相关文章:

  • 在线商标设计logo免费搜索seo是什么意思
  • 优质的低价网站建设seo入门到精通
  • 唐山如何做百度的网站建设搜索引擎优化方法案例
  • wordpress访客记录插件广东培训seo
  • 做网站会员金字塔系统百度搜索优化怎么做
  • 产品推广广告最新seo自动优化软件
  • 上海培训网站建设采集站seo提高收录
  • 如何在学校网站上做链接百度开车关键词
  • 南岸网站关键词优化武汉seo关键词排名
  • 网站怎么做必须交钱吗关键词怎样做优化排名
  • 网站 外包方案鹤壁搜索引擎优化
  • 国家森林公园网站建设百度竞价推广登录入口
  • 网站制作新报价东莞推广系统
  • 深圳公司排名前十名网站推广优化怎样
  • 自媒体seo是什么意思seo积分优化
  • 手机网站变灰网络营销专业学什么
  • 用vb做网站中国足球世界排名
  • 做门户网站需要什么资质百度下载
  • 瑞安做网站公司店铺推广软文案例
  • 英文版科技网站成都网络推广优化
  • 用ps做网站页面广东seo网站推广代运营
  • 施工企业有没有制造费用seo搜索引擎优化原理
  • 网站地图文件深圳竞价托管公司
  • 肇庆网站制作设计网站关键词排名优化
  • 吴江住房城乡建设局网站windows优化大师和鲁大师
  • 直销宣传网站制作网站广告投放收费标准
  • 政府机关网站制作模板关键词优化教程
  • 斗米兼职做任务发兼职网站靠谱吗免费发布广告信息的网站
  • 南宁信息建设网站关键词分析软件
  • 做漫画视频在线观看网站百度提交入口网址是什么