Waitrud Weber’s blog

things and reminders for memories

Analyzer: windows-make: A file pointer should inclement(++) or its specification:

A file pointer should inclement(++) if we find the character, we think, the below is a error.

souce code:

souce is the below.    
.\main.cpp  Wed Nov 04 19:14:56 2020
380 ://
381 ://
382 ://
383 ://
384 ://
385 :int found_enter_001 (char* filename) {
386 :	FILE *fp;
387 :	char b_dummy[256];
388 :	int i, j ;
389 :	int file_end;
390 :	STRUCT_FILE structure_fp;
391 :	char c;
392 :
393 :	printf("found_enter_001: starts\r\n");
394 :
395 :	fp = fopen(filename, "rb");
396 :	structure_fp.file_start = fp;
397 :	structure_fp.fp = fp;
398 :
399 :	file_end = filesize(fp);
400 :	structure_fp.file_end_index = file_end;
401 :	
402 :	for ( i =0; i<file_end && i<10; i++ ) {
403 :
404 :		printf("i: %d loop starts. ", i );
405 :		printf("struct_fp.fp |%d|\r\n", structure_fp.fp );
406 :
407 :		structure_fp.index = i;
408 :		dummy[0] = get_char( structure_fp );
409 :		dummy[1] = '\0';
410 :
411 :
412 :		printf("i: %d: |%s| \r\n", i, dummy);
413 :
414 :		// We could find flip side:
415 :		//
416 :		//
417 :/*		if ( b_dummy[0] == 13 && b_dummy[1] == 10 ) {
418 :			b_dummy[2] = '\0';
419 :			printf("We found Eenter opposite side: |%s|\r\n", b_dummy);
420 :			exit(-1);
421 :		}
422 :*/
423 :	}
424 :
425 :	printf("found_enter_001: ends\r\n");
426 :	return 0;
427 :}
428 :
429 :// https://bituse.info/c_func/48
430 ://
431 ://
432 :char get_char ( STRUCT_FILE structure_fp) {
433 :	long diff;
434 :	char c;
435 :	char dummy[255];
436 :
437 :	printf("get_char starts.\r\n");
438 :
439 :	diff = (long)structure_fp.fp - (long)structure_fp.file_start;
440 :
441 :	// set
442 :	//(long)structure_fp.file_start + (long)structure_fp.index;
443 :	//	fseek(fp,0,SEEK_END);
444 :	//	fseek(fp,0,SEEK_CUR);
445 :
446 :	printf("struct_fp.fp |%d| struct_fp.index |%d|\r\n", structure_fp.fp , structure_fp.index);
447 :
448 :	fseek( structure_fp.fp, structure_fp.index, SEEK_SET);
449 :	fread ( dummy, 1, 1, structure_fp.fp );
450 :
451 :	printf("struct_fp.fp |%d|\r\n", structure_fp.fp );
452 :
453 :	printf("get_char ends.\r\n");
454 :
455 :	return dummy[0];
456 :}
457 :



---
found_enter_001: starts
i: 0 loop starts. struct_fp.fp |1976736872|
get_char starts.
struct_fp.fp |1976736872| struct_fp.index |0|
struct_fp.fp |1976736872|
get_char ends.
i: 0: |G|
i: 1 loop starts. struct_fp.fp |1976736872|
get_char starts.
struct_fp.fp |1976736872| struct_fp.index |1|
struct_fp.fp |1976736872|
get_char ends.
i: 1: |u|
i: 2 loop starts. struct_fp.fp |1976736872|
get_char starts.
struct_fp.fp |1976736872| struct_fp.index |2|
struct_fp.fp |1976736872|
get_char ends.
i: 2: |n|
i: 3 loop starts. struct_fp.fp |1976736872|
get_char starts.
struct_fp.fp |1976736872| struct_fp.index |3|
struct_fp.fp |1976736872|
get_char ends.
i: 3: |d|
i: 4 loop starts. struct_fp.fp |1976736872|
get_char starts.
struct_fp.fp |1976736872| struct_fp.index |4|
struct_fp.fp |1976736872|
get_char ends.
i: 4: |a|
i: 5 loop starts. struct_fp.fp |1976736872|
get_char starts.
struct_fp.fp |1976736872| struct_fp.index |5|
struct_fp.fp |1976736872|
get_char ends.
i: 5: |m|
i: 6 loop starts. struct_fp.fp |1976736872|
get_char starts.
struct_fp.fp |1976736872| struct_fp.index |6|
struct_fp.fp |1976736872|
get_char ends.
i: 6: |0|
i: 7 loop starts. struct_fp.fp |1976736872|
get_char starts.
struct_fp.fp |1976736872| struct_fp.index |7|
struct_fp.fp |1976736872|
get_char ends.
i: 7: |0|
i: 8 loop starts. struct_fp.fp |1976736872|
get_char starts.
struct_fp.fp |1976736872| struct_fp.index |8|
struct_fp.fp |1976736872|
get_char ends.
i: 8: | |
i: 9 loop starts. struct_fp.fp |1976736872|
get_char starts.
struct_fp.fp |1976736872| struct_fp.index |9|
struct_fp.fp |1976736872|
get_char ends.
i: 9: |:|
found_enter_001: ends
---

willinglytranslate.blogspot.com