cÅжϺº×Ö
#include <windows.h>
int IsGB(PTSTR pText);
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szText[] = {TEXT ("i·þ,ÁË¡£u£ù")} ;
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; //Ó¢ÎÄ¡¢Êý×Ö¡¢Ó¢Îıêµã
}
Ïà¹ØÎĵµ£º
//»ñµÃºº×ÖµÄÇøÎ»Âë
¡¡¡¡byte[] array = new byte[2];
¡¡¡¡array = System.Text.Encoding.Default.GetBytes("°¡");
int i1 = (short)(array[0] - ''\0'');
¡¡¡¡int i2 = (short)(array[1] - ''\0'');
//unicode½âÂ뷽ʽϵĺº×ÖÂë
¡¡¡¡array = System.Text.Encoding.Unicode.GetBytes("°¡");
¡¡¡¡i1 = (short)(arra ......
#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 ......
Ò»¡¢
1¡¢¹ØÓÚ×Ö½Ú˳Ðò£º»°ËµÔÚÌØ¶¨µÄÓ²¼þƽ̨ÉÏ£¬¶à×Ö½ÚÊý¾ÝµÄ˳Ðò´æ·ÅÓÐÁ½ÖÖ·½Ê½£¨little-endian¡¢big-endian£©¡£Ç°ÕßµÄÊý¾ÝµÄµÍ×Ö½Ú
²¿·Ö´æ·ÅÔڵ͵ØÖ·Äڴ棬ºóÕßÇ¡ºÃÏà·´¡£PCÒ»°ãÊÇ»ùÓÚIA-32΢´¦ÀíÆ÷£¬ÊôÓÚlittle-endian¡£Ä³Ð©RISC¼Ü¹¹µÄCPU£¬ÀýÈçSPARC¡¢
POWERPCµÈ£¬ÔòÊ ......
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]; ......