C 字符串函数大全
函数名: stpcpy
功 能: 拷贝一个字符串到另一个
用 法: char *stpcpy(char *destin, char *source);
程序例:
#include <stdio.h>
#include <string.h>
int main(void)
{
char string[10];
char *str1 = "abcdefghi";
stpcpy(string, str1);
printf("%s\n", string);
return 0;
}
函数名: strcat
功 能: 字符串拼接函数
用 法: char *strcat(char *destin, char *source);
程序例:
#include <string.h>
#include <stdio.h>
int main(void)
{
char destination[25];
char *blank = " ", *c = "C++", *Borland = "Borland";
strcpy(destination, Borland);
strcat(destination, blank);
strcat(destination, c);
printf("%s\n", destination);
return 0;
}
函数名: strchr
功 能: 在一个串中查找给定字符的第一个匹配之处\
用 法: char *strchr(char *str, char c);
程序例:
#include <string.h>
#include <stdio.h>
int main(void)
{
char string[15];
char *ptr, c = 'r';
strcpy(string, "This is a string");
ptr = strchr(string, c);
if (ptr)
printf("The character %c is at position: %d\n", c, ptr-string);
else
printf("The character was not found\n");
return 0;
}
函数名: strcmp
功 能: 串比较
用 法: int strcmp(char *str1, char *str2);
看Asic码,str1>str2,返回值 > 0;两串相等,返回0
程序例:
#include <string.h>
#include <stdio.h>
int main(void)
{
char *buf1 = "aaa", *buf2 = "bbb", *buf3 = "ccc";
int ptr;
ptr = strcmp(buf2, buf1);
if (ptr > 0)
printf("buffer 2 is greater than buffer 1\n");
else
相关文档:
/*用if多层嵌套实现a,b,c大小的六种排序情况a>b>c,a>c>b,c>a>b,c>b>a,b>c>a,b>a>c*/
#include<stdio.h>
void main()
{
unsigned int a,b,c;
printf("please input three numbers a,b,c:");
scanf("%d%d%d",&a,&b,&c);
if ......
Java 2 C++ http://www.javaeye.com/topic/295776
1. 解决性能问题
Java具有平台无关性,这使人们在开发企业级应用的时候总是把它作为主要候选方案之一,但是性能方面的因素又大大削弱了它的竞争力。为此,提高Java的性能就显得十分重要。Sun公司及Java的支持者们为提高Java的运行速度已经做出了许多努力,其中大多数集中 ......
1.开发工具下载
TUBER C http://www.duote.com/soft/392.html
Turbo C 2.0 汉化版 http://www.programfan.com/showdown.asp?id=306
C-Free 4.0 http:/ ......
Google Android开发博客今天宣布,即日起开放针对Android平台的原生软件开发SDK下载。由于在SDK前面又加上了原生二字,即Native Development Kit,因此又被Google称为NDK。在此之前,Android平台的第三方应用程序均是依靠基于Java的Dalvik特制虚拟机进行开发的。原生 SDK的公布可以让开发者更加直接的接触Android系统资源, ......
一.环境的安装
下载安装包,Google上搜索php+apache+sql的安装包并安装。
二.扩展编程
针对在PHP环境下掉用C编程(c程序编译的dll),主要有以下两种方式。
1.利用ATL构建DLL组件,然后再PHP里面直接调用,调用方法 ......