1 | - | - | |
2 | .\main.cpp Tue Apr 19 19:03:48 2022 ... 166 :int read_html_tag(char* filename ) { 167 : STRUCT_FILE structure_fp; 168 : int file_end; 169 : FILE* fp; 170 : char* p_dummy; 171 : int i; 172 : int result; 173 : char key_buffer[255]; 174 : HTMLTAG* html=NULL; 175 : int html_count = 0; 176 : 177 : printf("int read_html_tag(char* filename ) starts.\r\n"); 178 : 179 : fp = fopen(filename, "rb"); 180 : printf("1 fp|%d|\r\n", fp); 181 : structure_fp.file_start = fp; 182 : structure_fp.fp = fp; 183 : 184 : file_end = filesize(fp); 185 : structure_fp.file_end_index = file_end; 186 : 187 : printf("file_size:%d\r\n", file_end); 188 : printf("2 fp|%d|\r\n", fp); 189 : 190 : for ( i =0; i<file_end; i++ ) { 191 : structure_fp.index = i; 192 : p_dummy = get_string( structure_fp , 5); 193 : p_dummy[5] = '\0'; 194 : if ( m_start_with ( (char*)p_dummy, "<" ) == 1 ) { 195 : printf("We found the |<| index %d fp|%d|.\r\n", i, fp ); 196 : result = get_inside( key_buffer, 255, ">", &structure_fp ); 197 : printf("key_buffer |%s|\r\n", key_buffer ); 198 : 199 : html = (HTMLTAG*) malloc ( sizeof(HTMLTAG) ); 200 : if ( html == NULL ) { 201 : printf("it cannot allocate the memory for the html(HTMLTAG).\r\n"); 202 : exit(-1); 203 : } 204 : html->inside = (char*)copyof( (char*) key_buffer); 205 : analyze_html_inside( html->inside, html, &result ); 206 : printf("result %d\r\n", result); 207 : 208 : switch(result) { 209 : case 1: 210 : printf("Next is going to be the between <%s> and </%s>\r\n", html->tagname, html->tagname); 211 : result = get_between( key_buffer, 255, html, &structure_fp ); 212 : printf("html|%p| result %d\r\n", html, result ); 213 : if ( result == 1 ) { 214 : html->between = (char*) copyof(key_buffer); 215 : html_count++; 216 : printf("tagname|%s| between|%s| html_count|%d|\r\n", html->tagname, html->between, html_count ); 217 : } 218 : break; 219 : case 2: 220 : break; 221 : default: 222 : exit(-1); 223 : } 224 : 225 : } 226 : aFree(p_dummy); 227 : } 228 : 229 : printf("int read_html_tag(char* filename ) ends.\r\n"); 230 : return 0; 231 :} ... |
||
3 | We found the |>| index 1030 fp|1967496296|. key_buffer |a href="https://www.geeksforgeeks.org/fseek-in-c-with-example/"| int get_inside( char* key_buffer, int max_buffer, char* end_string, STRUCT_FILE* sfp ) returns 1. key_buffer |a href="https://www.geeksforgeeks.org/fseek-in-c-with-example/"| int analyze_html_inside( char* inside, HTMLTAG* html, int* result ) starts. ac(array count) 63 tag=|a| We found '/' from end. 61/63 *result=2 int analyze_html_inside( char* inside, HTMLTAG* html, int* result ) return 1. result 2 We found the |<| index 1076 fp|1967496296|. int get_inside( char* key_buffer, int max_buffer, char* end_string, STRUCT_FILE* sfp ) starts. We found the |>| index 1079 fp|1967496296|. key_buffer |/a| int get_inside( char* key_buffer, int max_buffer, char* end_string, STRUCT_FILE* sfp ) returns 1. key_buffer |/a| int analyze_html_inside( char* inside, HTMLTAG* html, int* result ) starts. ac(array count) 2 tag=|/a| We found '/' from end. 0/2 *result=2 int analyze_html_inside( char* inside, HTMLTAG* html, int* result ) return 1. result 2 We found the |<| index 1080 fp|1967496296|. int get_inside( char* key_buffer, int max_buffer, char* end_string, STRUCT_FILE* sfp ) starts. We found the |>| index 1083 fp|1967496296|. key_buffer |/p| int get_inside( char* key_buffer, int max_buffer, char* end_string, STRUCT_FILE* sfp ) returns 1. key_buffer |/p| int analyze_html_inside( char* inside, HTMLTAG* html, int* result ) starts. ac(array count) 2 tag=|/p| We found '/' from end. 0/2 *result=2 int analyze_html_inside( char* inside, HTMLTAG* html, int* result ) return 1. result 2 int read_html_tag(char* filename ) ends. |
||
4 | |||
5 | |||
6 |