闹钟提醒我们该吃饭吃饭,该睡觉睡觉
softwaretimer.h
#ifndef _SOFTWARETIMER_H_
#define _SOFTWARETIMER_H_
typedef enum{z_false = 0, z_true = !z_false} z_bool;
typedef unsigned char...
分类:
其他好文 时间:
2014-06-08 17:37:14
阅读次数:
216
下面的代码片段输出是什么?为什么?
char *ptr;
if((ptr = (char *)malloc(0))==NULL)
puts("Got a null pointer");
else
puts("Got a valid pointer");
解析:......故意把0值传给了函数malloc,得到了一个合法的指针,这就是上面的代码,该代码的输出是"Got ...
分类:
其他好文 时间:
2014-06-08 17:11:28
阅读次数:
285
std::string CStringToSTDStr(const CString& theCStr)
{
// Convert the CString to a regular char array
const int theCStrLen = theCStr.GetLength();
char *buffer = (char*)malloc(sizeof(char)*(theCStrLe...
分类:
其他好文 时间:
2014-06-08 16:33:53
阅读次数:
218
关于+ - ~有意思的一段C代码
问题是钟哥几天前在automation的群里面抛出来的。
code:
#include
int main(int argc,char* argv[])
{
int a = 7;
int b = 1;
printf("before process,a = %d,b = %d\n",a,b);...
分类:
其他好文 时间:
2014-06-08 16:29:03
阅读次数:
215
C++中对数据库的操作感觉太复杂了,不如C#好使,但最近出于某些原因还是学习了一下C++下操作数据库的方法。
如果要想用C++实现对数据库的操作其实很简单,但是如果你需要动态的操作数据库(比如获得用户输入的数据后存入数据库)那么就麻烦一下,因为SQLExecDirect()这个函数接收的SQL语句需要是SQLWCHAR *格式的,并不是char *格式!所以要将普通的char *转换成SQLWC...
分类:
数据库 时间:
2014-06-08 15:33:26
阅读次数:
286
代码清单:
<?php
/**
* 检测输入中是否含有错误字符
* @author ruxing.li
* @param char $string 要检查的字符串名称
* @return boolean
*/
function is_badword($string) {
$badwords = array("\\",'&',' ',"'",'"','/','*',',',''...
分类:
其他好文 时间:
2014-06-08 14:49:48
阅读次数:
288
#include //使用C++标准库的string类时using namespace
std;//同上#include #include #include
//要将string类和int类型直接转换最好有这些包含,//因为自己写一个转换函数比较方便,函数定义参考如下string getstring...
分类:
编程语言 时间:
2014-06-08 06:37:42
阅读次数:
304
#include "stdafx.h"#include #include #include const
int maxCount = 100;const int strMaxLen = 16; BOOLEAN IsMatchPattern(const char*
ipPattern,const .....
分类:
其他好文 时间:
2014-06-08 01:33:47
阅读次数:
219
/*** author geksong * function 中文字符串相关操作**/public
class ChinaStringUtil {/** * 判断字符是不是中文字符 * @param c * @return */public static
boolean isChinese(char...
分类:
编程语言 时间:
2014-06-08 00:16:40
阅读次数:
385
题意:给定N个字符串 每个字符串可以看为一个点 每个点之间都有边 长度为对应两点之间字符不同的个数
把这些点连接起来 求最小的边长思路:Kruskal 算法的简单应用#include#includeusing namespace std;char
a[2222][10];int dist[2222]...
分类:
其他好文 时间:
2014-06-07 23:07:30
阅读次数:
237