文本中的
如何将文本中的"4B84EFD8"提取出来并生成如下的二进制数组0,1,0,0,1,0,1,1,1,0,0,0,0,1,0,0,1,1,1,0,1,1,1,1,1,1,0,1,1,0,0,0
test.rar
(611 Bytes)
#include <stdio.h> #include <stdlib.h> int main(void) { int hex1 = 0X4B84EFD8, hex2; FILE * fp; int ch, i, j; if(!(fp = fopen("test.TXT", "r"))) { printf("can't open test.TXT\n"); exit(1); } while(1) { i = fscanf(fp, "%X", &hex2); if(i != 1) { j = getc(fp); } else { if(hex1 == hex2) { printf("OK\n"); // 这个地方就找到了4B84EFD8, 觉得你已经知道了这个值干嘛还要去找它呢?是不是应该找Address=0_后面的十六进制啊? } } if(j == EOF) { break; } } fclose(fp); return 0; }至于组成二进制数组,你自己去想吧!