摘要:
转载自“百度百科”#pragma once 这是一个比较常用的指令,只要在头文件的最开始加入这条指令就能够保证头文件被编译一次 #pragma once用来防止某个头文件被多次include,#ifndef,#define,#endif用来防止某个宏被多次定义。 #pragma once是编译相关,就是说这个编译系统上能用,但在其他编译系统不一定可以,也就是说移植性差,不过现在基本上已经是每个编译器都有这个定义了。 #ifndef,#define,#endif这个是C++语言相关,这是C++语言中的宏定义,通过宏定义避免文件多次编译。所以在所有支持C++语言的编译器上都是有效的,如果写的程序要 阅读全文
摘要:
一、移植环境u-boot版本:u-boot-2011.06-rc2Linux版本:Ubuntu 11.04交叉编译工具:arm-linux-gcc-4.3.2(友善之臂)开发板:友善之臂mimi2440CPU:s3c2440SDRAM:64MBNor Flash:2MBNand Flash:128MB网卡:DM9000二、准备工作1、下载u-boot-2011.06-rc2,地址:ftp://ftp.denx.de/pub/u-boot/2、解压u-boot到工作路径。tar -xvjf u-boot-2011.06-rc2.tar.bz2 /home/prince/workspace/3、在 阅读全文
摘要:
STATUS str_cmp_no_case(const char* v_p_str1, const char* v_p_str2){ int i = 0; if(strlen(v_p_str1) != strlen(v_p_str2)) { return ERROR; } while(i < strlen(v_p_str1)) { if(v_p_str1[i] == v_p_str2[i] || v_p_str1[i] + 32 == v_p_str2[i] || v_p_str1[i] - 32 == v_p_str2[i]) { i++; continue; } return ER 阅读全文
摘要:
1.sizeof操作符的结果类型是size_t,它在头文件中typedef为unsigned int类型。 该类型保证能容纳实现所建立的最大对象的字节大小。2.sizeof是运算符,strlen是函数。3.sizeof可以用类型做参数,strlen只能用char*做参数,且必须是以''\0''结尾的。 sizeof还可以用函数做参数,比如: short f(); printf("%d\n", sizeof(f())); 输出的结果是sizeof(short),即2。4.数组做sizeof的参数不退化,传递给strlen就退化为指针了。5.大部 阅读全文
摘要:
STATUS del_space(char* v_p_Str){ int len; char* pBkup = NULL; char* pSrcStr = NULL; char* pDesStr = NULL; char* pEnd = NULL; char chFind = ' '; if(NULL == v_p_Str) { return ERROR; } len = strlen(v_p_Str); if(NULL == (pSrcStr = (char*)malloc(len + 1))) { return ERROR; } strcpy(pSrcStr, v_p_St 阅读全文
摘要:
STATUS ip_valid_check(const char* v_p_Str){ int i; int tmp; char* p = NULL; if(strlen(v_p_Str) > 15) { return ERROR; } p = (char*)v_p_Str; tmp = atoi(p); if(tmp > 255 || tmp < 0) { return ERROR; } for(i = 0; i < 3; i++) { if(NULL == (p = strchr(p, '.'))) { return ERROR; } p++; tm 阅读全文
摘要:
/***********************************************************************************Convert ip address from string to hex. Assumed the string is valid. u_pIpAdrsChar ----- IP address stored in string. v_pIpAdrsInt ----- Output parameter.*************************************************************** 阅读全文
摘要:
CheckBox是一种在界面开发中比较常见的控件,Android中UI开发也有CheckBox,简单的说下它的使用,每个CheckBox都要设置监听,设置的监听为CompouButton.OnCheckedChangedListener()。代码main.xml文件内容为:代码运行结果为: 阅读全文
摘要:
RadioGroup和RadioButton代表的是Android中单选按钮的一种控件,写个简单的代码熟悉一下:[代码]main.xml文件如下:[代码]效果如下: 阅读全文
摘要:
在一个Activity中使用Intent发送短信[代码] // 使用Intent发短信 Uri uri = Uri.parse("smsto:13800000000"); Intent intent = new Intent(Intent.ACTION_SENDTO,uri); intent.putExtra("sms_body", "The SMS text"); startActivity(intent); } }); }} 阅读全文