unsigned char拼接

来源:互联网 发布:淘宝店铺域名修改 编辑:程序博客网 时间:2024/06/18 17:55
// testNoMFC.cpp : 定义控制台应用程序的入口点。
//


#include "stdafx.h"


#include <string>
#include <Windows.h>
unsigned char str_fir[] = "你好";
int main( char * argv , char** argc )
{
 
    unsigned char str_sec[] = "世界";
    unsigned char str_rlt[260] = {0};
    int len_fir = strlen( ( const char *)str_fir );
    int len_sec = strlen( ( const char *)str_sec );
    for ( int iCnt = 0 ; iCnt < len_fir ; ++iCnt )
    {
        str_rlt[iCnt] = str_fir[iCnt];
    }
    for ( int iCnt = 0 ; iCnt < len_sec ; ++iCnt )
    {
        str_rlt[len_fir+iCnt] = str_sec[iCnt];
    }
    printf( "结果为:%s\n" , str_rlt );
    system( "pause" );
    return 0;//思路最简单滴版本
}

0 0