易截截图软件、单文件、免安装、纯绿色、仅160KB

c/c++ string


1.本章思维导图:



Example1:
char
*strcpy(char *target, const char *source) {
  char *t = target;

  // Copy the contents of source into target.
 
while(*source) *target++ = *source++;
  // Null-terminate the
target.
  *target = '\0';
  // Return pointer to the
start of target.
  return t;
}
Example2:
void
*memmove(void *target, const void *source, size_t count)
这个函数即使
是在源和目的字符串有所重叠时操作也能成功,虽然source为const,但是其指向的array也可能被修改。
2.
C型字符串操作实例:
Ex1.基本操作
/*
*

=====================================================================================

*
*       Filename:  2-1.cpp
*
*   
Description:  Fundamental Operations in C Type String
*
*       
Version:  1.0
*        Created:  05/11/2010 10:43:11 AM
*      
Revision:  none
*       Compiler:  gcc
*
*        
Author:  gnuhpc (http://blog.csdn.net/gnuhpc)
,
warmbupt@gmail.com
*        Company:  IBM CDL
*
*

=====================================================================================

*/
#include 
#include 
using namespace std;
int main(int argc, char *argv[])
{

    char strA[7]="UP";
    char strB[5]="DOWN";
   
char strC[5]="LEFT";
    char strD[6]="RIGHT";
   
/*Display */
    cout << "Here are the strings: " <<
endl;


相关文档:

c/c++头文件,保存,备用

 
C、传统 C++
#include <stdio.h>     //定义输入/输出函数
#include <stdlib.h>    //定义杂项函数及内存分配函数
#include <string.h>    //字符串处理
#include <assert.h>    //设定插入点
#include <ctype.h>     //字符处理
#include <errno.h&g ......

C函数库介绍: string.h、mem.h

操作函数,所在函数库为string.h、mem.h
mem…操作存贮数组
void *memccpy(void *destin,void *source,unsigned char ch,unsigned n)
void *memchr(void *s,char ch,unsigned n)
void *memcmp(void *s1,void *s2,unsigned n)
int   memicmp(void *s1,void *s2,unsigned n)
void *memmove(void *destin ......

C和C++的点滴积累(1)

                     C和C++的点滴积累(1)
1. mfc 编程中存在着如果出现“内存不足”的对话框,一种情况是在申请内存的时候出现问题,也就是例如:char *pChar = new char[num]; 但此时num 为零或者负 ......

Delphi调用VC++6.0编写的Dll

用VC++6.0编写了一个简单的dll,里面包含一个减法函数subtract(int a,int b),Dll命名为ff.Dll
代码如下:
1.ff.cpp:
// ff.cpp : Defines the entry point for the DLL application.
//
#include "StdAfx.h"
#include "ff.h"
BOOL APIENTRY DllMain( HANDLE hModule,
        ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号