2 |
replace.cpp Tue Jul 12 16:55:16 2022
... 1266 // 1267 char* get_string ( STRUCT_FILE structure_fp, int num ) { 1268 long diff; 1269 char c; 1270 1271 err_msg_001("char* get_string ( STRUCT_FILE structure_fp, int num ) starts.\r\n"); 1272 1273 diff = (long)structure_fp.fp - (long)structure_fp.file_start; 1274 1275 // set 1276 //(long)structure_fp.file_start + (long)structure_fp.index; 1277 // fseek(fp,0,SEEK_END); 1278 // fseek(fp,0,SEEK_CUR); 1279 1280 printf("struct_fp.fp |%d| struct_fp.index |%d| num |%d|\r\n", structure_fp.fp , structure_fp.index, num); 1281 1282 gg_dummy == (char*)malloc (sizeof(char) * num); 1283 if (gg_dummy == NULL ) { 1284 printf("012: gg_dummy is NULL.\r\n"); 1285 exit(-1); 1286 } 1287 put_memories(gg_dummy); 1288 1289 fseek( structure_fp.fp, structure_fp.index, SEEK_SET); 1290 fread ( gg_dummy, 1, num, structure_fp.fp ); 1291 1292 err_msg_001("struct_fp.fp |%d|\r\n", structure_fp.fp ); 1293 1294 printf("char* get_string ( STRUCT_FILE structure_fp, int num ) ends.\r\n"); 1295 1296 return gg_dummy; 1297 } 1298 ...
|
|
|
3 |
main.cpp Tue Jul 12 16:58:25 2022
... 119 :int main ( int argc, char** argv ) { 120 : 121 : char* string_all = read_all ( ".\\001-i-block-20220712-001\.txt" ); 122 : printf("string_all: |%p|\r\n%s\r\n", string_all, string_all ); 123 : 124 : char* string_all_001 = read_all (".\\001-for-20220712-001\.txt"); 125 : printf("string_all_001: |%p|\r\n%s\r\n", string_all_001, string_all_001 ); 126 : 127 :// char* c_replace = m_replace( string_all_001, "(i block)", string_all ); 128 :// printf("c_replace:\r\n %s\r\n", c_replace ); 129 : 130 : return 0; 131 :} ...
|
|
|
4 |
replace.cpp Tue Jul 12 16:55:16 2022
... 268 :// 269 :char* read_all (char* filename ) { 270 : FILE *fp; 271 : char b_dummy[256]; 272 : int i, j ; 273 : int file_end; 274 : STRUCT_FILE structure_fp; 275 : char c; 276 : char* p_dummy = NULL; 277 : char* p_dummy_token = NULL; 278 : int canread; 279 : char* block_string; 280 : int b_index = 0; 281 : char w_filename[255]; 282 : int index = 0; 283 : int col = 0; 284 : 285 : err_msg_001("read_all starts.\r\n"); 286 : 287 : fp = fopen(filename, "rb"); 288 : structure_fp.file_start = fp; 289 : structure_fp.fp = fp; 290 : 291 : file_end = filesize(fp); 292 : structure_fp.file_end_index = file_end; 293 : 294 : canread = 1; 295 : int ini = initialize_parse (); 296 : 297 : // Lootn check if we set 100 to the text file. 298 : for ( i =0; i<file_end && i <10000; i++ ) { 299 : 300 : err_msg_001("i: %d loop starts. ", i ); 301 : err_msg_001("struct_fp.fp |%d|\r\n", structure_fp.fp ); 302 : 303 : structure_fp.index = i; 304 : p_dummy = get_string( structure_fp , 1); 305 : p_dummy[1] = '\0'; 306 : 307 : p_dummy_token = put_token( p_dummy[0] ); 308 : } 309 : 310 : fclose(structure_fp.fp); 311 : err_msg_001("read_all ends.\r\n"); 312 : 313 : return p_dummy_token; 314 :} 315 : ,,,
|
|
|