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

c判断汉字

#include <windows.h>
int IsGB(PTSTR pText);
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
     PSTR szCmdLine, int iCmdShow)
{
 static TCHAR szText[] = {TEXT ("i服,了。uy")} ;
 PTSTR pText;
 int i;
 unsigned char sqChar[20];
 pText=szText;
 while (*pText != '\0')
 {
  i=IsGB(pText);
  switch(i)
  {
  case 0:
   pText++;
   MessageBox (NULL, TEXT ("发现数字、英文字符或英文标点"), TEXT ("Hello"), 0);
   break;
  case 1:
   pText++;
   pText++;
   MessageBox (NULL, TEXT ("发现全角字符"), TEXT ("Hello"), 0);
   break;
  case 2:
   pText++;
   pText++;
   MessageBox (NULL, TEXT ("发现汉字"), TEXT ("Hello"), 0);
   break;
  }
 }
 return 0 ;
}
int IsGB(PTSTR pText)
{
 unsigned char sqChar[20];
 sqChar[0]=*pText;
 if (sqChar[0]>=0xa1)
  if (sqChar[0]==0xa3)
   return 1; //全角字符
  else
   return 2; //汉字
 else
  return 0; //英文、数字、英文标点
}


相关文档:

纯C实现c++类

//#include "stdafx.h"
/*
描述:纯c模拟类,纯c编写c++类,纯c实现c++类的简单范例,结构模拟类,struct 编写class.
c编写类是实现纯c编写com组件的基础。
*/
#include <stdio.h>
typedef struct _Vtbl
{
    void (*AddRef)(struct CObject* obj,int);//所有的函数的第一个参数类似class的隐匿的 ......

C Snippet #8(规定时间输入,否则默认跳转的实现)

http://www.ddj.com/cpp/221600722
Q: HOW DO I... put timers with default actions in my C code?
A: Many times, we need to write programs that will only wait a certain specified amount of time for a user to do something. After that time, we need to assume that the user isn't going to do anything and ......

c/c++ 左值 右值讨论

左值性(lvalueness)在C/C++中是表达式的一个重要属性。只有通过一个左值表达式才能来引用及更改一个对象(object)的值。(某些情况下,右值表达式也能引用(refer)到某一个对象,并且可能间接修改该对象的值,后述)。
    何谓对象?如果没有明确说明,这里说的对象,和狭义的类/对象(class/object) ......

C 和 C++ 字符串字面量

C 和 C++ 字符串字面量(String Literal)既有相同之处,又有一些区别。了解这些内容对于加深字符串字面量以及相关一些概念的理解、澄清一些常见的概念误区不无助益。本文以普通字符串字面量 "hello" 为例总结说明如下。
相同点:
字符串字面量是对象
C/C++ 中的对象(Object)指的是一块存储区。字符串字面量是不需要创 ......

The C Programming Language

To be continued...
第8章 UNIX系统接口
#include <stdio.h>
#include <fcntl.h>
#include "syscalls.h"
#defien PERMS 0666
void error(char *, ...);
/* cp函数: 将 f1 复制到 f2 */
int main(int argc, char *argv[])
{
    int f1, f2, n;
    char buf[BUFSIZ]; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号