逐个比较ascii码。
汉字的字节码>125?

解决方案 »

  1.   

    (buff[i] & 0x80) != 0就可以了
      

  2.   

    main()
    {
    int j;
    FILE *fp;
    char filename[50],str;
    printf("file name!\n");
    scanf("%s",&filename);
    if((fp=fopen(filename,"rb"))==NULL) {
        printf("Error opening source file!\n");
        return -1;
    }
    j=0;
    do {
        str=fgetc(fp);
       if (!((str>0)&(str<128)))
       j=1;} while(!feof(fp));
    printf("j=%d",j);
    return 0;
    }
    若j=1则说明其中有中文,否则则没有
      

  3.   

    汉字的高位码>0xA0
        while (TempChar = * strin ++)
        {
            if (TempChar == 0x0A)   /* new line */
            {
                if (LastChar != 0)
                {
                    *p++ = LastChar;
                    LastChar = 0;
                }           *p ++ = TempChar;
            }
            else if (LastChar != 0)  /* a chinese char second byte? */
            {
                OutChar = 0;
                index = (LastChar - 0xA1) * 0x5E + (TempChar - 0xA1);
                    /* TempChar: second byte, LastChar: first byte */
                if (index >= 0 && index < GBToBig5TblSize)
                    OutChar = GBToBig5Tbl[index];            if (OutChar != 0)
                {
                    * p ++ = HIBYTE(OutChar);
                    * p ++ = LOBYTE(OutChar);
                }
                else
                {
                    * p ++ = HIBYTE(BIGbox);
                    * p ++ = LOBYTE(BIGbox);
                }
                LastChar = 0;
            }
            else if (TempChar > 0xA0)
            {
                LastChar = TempChar;
            }
            else
            {
                * p ++ = TempChar;
            }
            /* a new single char, is a chinese first byte ? */
        }