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; //英文、数字、英文标点
}
相关文档:
DllImport所在的名字空间 using System.Runtime.InteropServices;
[DllImport("User32.dll")]
public extern static System.IntPtr GetDC(System.IntPtr hWnd);
private void button19_Click(obj ......
#include <windows.h>
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd )
{
OPENFILENAME ofn;
//在内存中开辟一块空间,存放用户选取的文件名
char szFile[MAX_PATH];//MAX_PATH ......
看数据结构裢栈的时候写了这么一段代码
#include<stdio.h>
#include<stdlib.h>
struct linkstack
{
int data;
struct linkstack *next;
};
int initstack(linkstack * S)
{
S = (linkstack *)malloc(sizeof(linkstack));
if(S == NULL) return 0;
S->next = NULL;
return 1;
}
int main(int ......
C和C++的标准库
默认分类 2008-02-28 14:28 阅读3 评论0
字号: 大大 中中 小小
http://blog.chinaunix.net/u/6776/showart_186792.html C/C++深层探索
本小节我们概览一下C/C++标准库的全貌。
C/C++标准库的内 ......