Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.8 KiB

  1. //
  2. // ���C ²�X ���X�{��
  3. //
  4. // ���Ż� 1998/03/15
  5. //
  6. #include <windows.h>
  7. #include <stdio.h>
  8. #include "resource.h"
  9. #define CharSize 2 //for unicode file format
  10. int cvthigh(char *FileName,char *OutName,DWORD *line)
  11. {
  12. FILE *fin;
  13. FILE *fout;
  14. WORD temp;
  15. int i;
  16. *line =1;
  17. // open input file
  18. if((fin = fopen(FileName,"rb")) ==NULL)
  19. return IDS_ERROPENFILE;
  20. fread(&temp,CharSize,1,fin); // for unicode header
  21. // open output file
  22. if((fout=fopen(OutName,"wb"))==NULL)
  23. {
  24. fclose(fin);
  25. return IDS_ERRCREATEFILE;
  26. }
  27. while(fread(&temp,1,CharSize,fin))
  28. {
  29. if (temp!=' ') //�C�C�Ĥ@�r���ťզr���ɡA�ӦC�Y�����ѦC
  30. {
  31. // cut not chinese char
  32. do {
  33. if(temp>255) break;
  34. } while(fread(&temp,1,CharSize,fin));
  35. if(feof(fin)) break; //finsh!
  36. // get chinese (10 characters)
  37. i=0;
  38. do {
  39. if(temp<=255)
  40. break;
  41. if(temp==0x25a1) temp=0; // non-character
  42. fwrite (&temp,1,sizeof(temp),fout); // write to output file
  43. i++;
  44. } while (fread(&temp,1,CharSize,fin));
  45. if (i!=10)
  46. {
  47. fclose(fin);
  48. fclose(fout);
  49. return IDS_ERRFORMATCODE;
  50. }
  51. }
  52. while(temp!=0x000a) // goto end of line ...
  53. if(!fread(&temp,1,CharSize,fin))
  54. break;
  55. (*line) ++;
  56. }
  57. fclose(fin);
  58. fclose(fout);
  59. return 0;
  60. }