0x47,
0x49,
0x46,
0x38,
0x39,
0x61,
0x88,
怎样将它转换成2进制并寸在另一个文件里或者覆盖原文件
如能告知不胜感谢
 2006-09-12 18:36
	    2006-09-12 18:36
   2006-09-12 20:44
	    2006-09-12 20:44
   2006-09-12 21:17
	    2006-09-12 21:17
   2006-09-13 09:30
	    2006-09-13 09:30
  问题已经解决,程序如下
#include <stdio.h> 
#include <iostream.h>
int main()
{
   unsigned int num;
   unsigned int bit;
   int start_print, i; 
   FILE *fp1 = fopen("g:\\work\\G_C401.OUT", "rt");
   FILE *fp2 = fopen("g:\\B.txt", "wt");
   if (!fp1 || !fp2)
   {
      if (fp1) fclose(fp1);
      if (fp2) fclose(fp2);
      return 1;
   } 
    int ret  = fscanf(fp1, "0x%x,\n", &num);
    cout << ret << endl;
   while( ret )
   {
      start_print = 0; 
      for (i=31; i>=0; i--)
      {
         bit = ( ((1 << i) & num ) != 0 );
         if (!start_print && bit != 0)
            start_print = 1;
         if (!start_print && i==0)
            start_print = 1; 
         if (start_print)
            fprintf(fp2, "%d", bit); 
      }
      fprintf(fp2, ",\n");
      ret = fscanf(fp1, "0x%x,\n", &num);
//      if(feof(fp1)>0)
//          break;
   } 
   
   fclose(fp1);
   fclose(fp2);
   return 0;
}
 2006-09-13 17:35
	    2006-09-13 17:35