Key:
int int int'n '; i++ ) {;}}
For example:
1#include <stdio.h>2#include <stdlib.h>3#include <string.h>4 5 #defineStr_len 106 7 voidStr_get_middlle (Char*result,Char*STR,intStartintend);8 9 intMainintargcChar*argv[])Ten { OneFILE *FP =NULL; A Char*file_path =NULL; - CharStr[str_len] ="", result[str_len] =""; - the if(ARGC = =1){ -printf"Too few augument (s) \ n" ); - exit (exit_failure); - } + -File_path = * (+ +argv); + A if(fp = fopen (File_path,"R")) ==NULL) { atprintf"Opening file error! path:%s\n", File_path); - exit (exit_failure); - } - Else{ -printf"Opening file [%s] was successfully!\n", File_path); - } in - to while(Fgets (str,sizeof(str), FP)! =NULL) { + //printf ("%s", str); -Str_get_middlle (result, str,0,1); theprintf"%s-", result); * $Str_get_middlle (result, str,2,3);Panax Notoginsengprintf"%s-", result); - theStr_get_middlle (result, str,4,5); +printf"%s\n", result); A } the + return 0; -}
Means: 00112233 >> 00-11-22-33. This code can formt MAC address.
Get string Middle by C