1 /* 2 * hello.c 3 * 4 * Created on: 2015年7月9日 5 * Author: 10171939 6 */ 7 8 #include<stdio.h> 9 #include<string.h> 10 #include<strings.h> 11 12 int main() 13 { 14 char filename[] = "e:\\DCX81_MOD_UART.info"; 15 char CMBS_Release[] = "CMBS Release "; 16 char CMBS_TARGET_API_Version[] = "CMBS TARGET API Version "; 17 18 char strValue[12] = { 0 }; 19 FILE *fp; 20 char StrLine[1024]; 21 22 if ((fp = fopen(filename, "r")) == NULL) 23 { 24 printf("error!\n"); 25 return -1; 26 } 27 28 while (!feof(fp)) 29 { 30 memset(StrLine, 0, 1024); 31 fgets(StrLine, 1024, fp); 32 if (strstr(StrLine, CMBS_Release) != NULL) 33 { 34 strcpy(strValue, StrLine + strlen(CMBS_Release)); 35 printf("%s: %s", CMBS_Release, strValue); 36 } 37 else if (strstr(StrLine, CMBS_TARGET_API_Version) != NULL) 38 { 39 strcpy(strValue, StrLine + strlen(CMBS_TARGET_API_Version)); 40 printf("%s: %s", CMBS_TARGET_API_Version, strValue); 41 } 42 else 43 { 44 continue; 45 } 46 47 } 48 49 fclose(fp); 50 return 0; 51 52 }
时间: 2024-11-09 01:00:42