<string.h>的学习
感觉学习代码库最好的方法就是运行一下。
下面附上结果和示例代码
#include <stdio.h>
#include <string.h> int main(){
const char * cs="Hello World";
const char * ct="Hello";
char * s=malloc();
memset(s,,);
char * t;
int c='o';
const size_t n=;
//strcpy(s,ct);
printf("const char * cs=Hello World;\n\
const char * ct=Hello;\n\
int c=o;\n\
const size_t n=;\n\
");
printf("=============================================\n");
printf("\tthe result of strcpy(s,ct) is: %s\n",strcpy(s,ct));
t=strncpy(s,ct,n);
*(t+n)='\0';
printf("\tthe result of char * strncpy(s,ct,n) is: %s\n",t);
memcpy(s,ct,strlen(ct));//copy ct to s
printf("\tthe result of char * strcat(s,ct) is: %s\n",strcat(s,ct));
printf("\tthe result of char * strchr(cs,c) is: %s\n",strchr(cs,c));
printf("\tthe result of char * strrchr(cs,c) is: %s\n",strrchr(cs,c));
printf("\tthe result of size_t strspn(cs,ct) is: %d\n",strspn(cs,ct));
printf("\tthe result of char * strpbrk(cs,ct) is: %s\n",strpbrk(cs,ct));
printf("\tthe result of size_t strlen(cs) is: %d\n",strlen(cs));
}
结果如下:

<string.h>的学习的更多相关文章
- <c:set var="ctx" value="${pageContext.request.contextPath}" />的学习
${pageContext.request.contextPath},是获取当前根目录 set var="ctx",是给这个路径定义了一个变量,用的时候可以通过EL表达式获取:${ ...
- ${pageContext.request.contextPath} JSP取得绝对路径
一.问题 JSP中究竟采用绝对路径还是采用相对路径随着所采用技术的越来越复杂,这个问题也变得越来越难以解决. 1)采用相对路径遇到的问题 相对路径固然比较灵活,但如果想复制页面内的代 ...
- 关于${pageContext.request.contextPath}的理解 (转载)
${pageContext.request.contextPath}是JSP取得绝对路径的方法,等价于<%=request.getContextPath()%> . 也就是取出部署的应用程 ...
- 关于${pageContext.request.contextPath}的理解(转载)
${pageContext.request.contextPath}是JSP取得绝对路径的方法,等价于<%=request.getContextPath()%> . 也就是取出部署的应用程 ...
- pageContext.request.contextPath
jsp:<c:set var="ctxStatic" value="${pageContext.request.contextPath}"/>嵌套d ...
- jsp里面不能使用${pageContext.request.contextPath}解决方案
1.在jsp中使用${pageContext.request.contextPath}获取相对路径,可是最后路径变为:http://localhost:8080/oneself/$%7BpageCon ...
- js文件中获取${pageContext.request.contextPath}
一般从 JSP文件中,可以直接使用 ${pageContext.request.contextPath}非常方便的获得当前页面的路径,用来处理被 Apache2代理之后出现 URL变化的问题,比如增加 ...
- <jsp:include page="${pageContext.request.contextPath/index.jsp" ></jsp:include> 引发的错误
路径引发的错误 如下使用项目路径对jsp页面进行获取,会报javax.servlet.ServletException: File "/web/dbwx/web/public/page_to ...
- js(JavaScript)使用${pageContext.request.contextPath}报错
前几天写程序在js文件中用到了${pageContext.request.contextPath}然后一直报错,没有办法post到服务器,原来js把这个当成字符串了,一直以为他是jquery的函数! ...
- ${pageContext.request.contextPath}无效
发现在Tomcat7.0.58,在jsp页面使用${pageContext.request.contextPath}获取不到项目名称,网上找了很多答案试了都无效: 把Tomcat版本换成Tomcat7 ...
随机推荐
- 查看CPU核数和内存
查看CPU核数 top 然后按数字键1 通过虚拟文件系统proc,直接获取CPU总数量 cat /proc/cpuinfo | grep processor 查看内存 free命令主要用于显示内存数量 ...
- [ES]ES查询指南
我们通常用用_cat API检测集群是否健康. 确保9200端口号可用: curl 'localhost:9200/_cat/health?v' 绿色表示一切正常, 黄色表示所有的数据可用但是部分副本 ...
- c++11 template 模板练习
直接上代码吧 to do // 111111.cpp: 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iostream> ...
- 【Web】网页字体图标的使用
字体图标介绍 网页中图片有很多优点,但也有很多缺点,会增加文件的大小以及增加http请求.这时候就需要用的字体图标(iconfont).字体图标的优点,可以跟图片一样改变透明度.旋转等,本质上是文字, ...
- git版本控制工具的使用(2)
git checkout -b dev创建一个为dev的分支.并选择该分支. git branch dev 创建分支 git checkout dev 选择该分支 git branch 查看当前分支和 ...
- python文件打包
python文件打包 先安装 pip3 install --upgrade pyinstaller 进入到文件的当前目录 ,在命令行中输入: pyinstaller -F -w[文件名].py 其中- ...
- git安装项目步骤
1.git clone git@gitee(github).com:项目地址.git 2.cd 项目根目录 3.composer install 4.如果需要数据迁移,cmd中到项目根目录 php a ...
- myeclipse cannot connect to vm
启动tomcat时,tomcat可以直接运行,而debug时弹出 解决方法:打开360安全卫士的功能大全找到修复网络(LSP)点击立即修复就可以使用debug
- IntelliJ IDEA 2017版 spring-boot 2.03 去除控制台logo;去除springboot 图标;去除springboot 图
1.控制台出现logo图标 2.如果不喜欢,如何去除这个logo 在其Application中进行设置 package com.springboot.logo; import org.springfr ...
- nginx proxy_pass后的url加不加/的区别
在nginx中配置proxy_pass时,当在后面的url加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,则会把匹配的路径部分也给代理走. 下面四种 ...