Waitrud Weber’s blog

things and reminders for memories

Language Support: Windows-make: Reading Files: UTF-16( Unicode ): As your Language:

-- memorization of lines global is well as work, so that, we could print it well. That is one of features, we think. ---

.\main.cpp  Sat Jul 04 19:49:51 2020

  1 :#include 
  2 :#include 
  3 :
  4 :#include "Print.h"
  5 :#include "array_counter.h"
  6 :#include "parse.h"
  7 :
  8 :int filesize( FILE *fp ) ;
  9 :
 10 :char lines[10][10];
 11 :
 12 :
 13 :int main () {
 14 :	FILE *fp;
 15 :	int i;
 16 :	char dummy[256];
 17 :	char* filename = ".\\alphabet-001.txt";
 18 :	char* filename_split = ".\\001-split-001.txt";
 19 ://	char spit_line[10];
 20 :	char basic[3];
 21 :
 22 :	basic[2] = '\0';
 23 :
 24 :	fp = fopen(filename_split, "rb");
 25 :	int file_end = filesize ( fp );
 26 :
 27 :
 28 :
 29 :
 30 :	int start = 0;
 31 :	int j = 0;
 32 :	// first, we are going to find "spit_line".
 33 :	// each block should be stored as block name eve like "001-block---001.txt".
 34 :	// and we care following orders.
 35 :	//
 36 :	for ( i =0; i<file_end; i++ ) {
 37 :		printf("loop start i: %d: j: %d: \r\n", i, j );
 38 :		fread ( dummy, 1, 1, fp);
 39 :
 40 :		dummy[1] = '\0';
 41 :		basic[1] = dummy[0];
 42 :
 43 :		// find line end.
 44 :		if ( m_compare( (char*)basic, (char*)"\r\n" ) == 1 ) {
 45 :			lines[j][i- start - 1 ] = '\0'; //---\r\n if i= 4
 46 :			j++;
 47 :			start = i + 1;
 48 :			//printf("i %d j %d temporary end.\r\n");
 49 :			//exit(-1);
 50 :		} else {
 51 :			lines[j][ i - start ] = dummy[0];
 52 :			lines[j][ i - start + 1 ] = '\0';
 53 :		}
 54 :
 55 :		printf("loop   end i: %d: |%s| j:%d|%s| basic|%s| start:%d\r\n", i, dummy, j, lines[j], basic, start);
 56 :		basic[0] = basic[1];
 57 :	}
 58 :
 59 ://	printf("split_line: %s\r\n", spit_line);
 60 :	fclose(fp);
 61 :
 62 :	for ( i =0; i<10; i++ ) {
 63 :		printf("lines[%d]|%s|\r\n", i, lines[i]);
 64 :	}
 65 :
 66 :
 67 :	/*fp = fopen(filename, "rb");
 68 :	file_end = filesize ( fp );
 69 :	for ( i =0; i<file_end; i++ ) {
 70 :		fread ( dummy, 1, 1, fp);
 71 :		dummy[1] = '\0';
 72 :		printf("%d: %s\r\n", i, dummy);
 73 :	}
 74 :
 75 :	close(fp);*/
 76 :	return 0;
 77 :}
 78 :
 79 :int filesize( FILE *fp ) {
 80 :
 81 :	fseek(fp, 0L, SEEK_END);
 82 :	int sz = ftell(fp);
 83 :
 84 :	fseek(fp, 0L, SEEK_SET);
 85 :
 86 :	return sz;
 87 :}
---
loop start i: 0: j: 0:
loop   end i: 0: |-| j:0|-| basic|| start:0
loop start i: 1: j: 0:
loop   end i: 1: |-| j:0|--| basic|--| start:0
loop start i: 2: j: 0:
loop   end i: 2: |-| j:0|---| basic|--| start:0
loop start i: 3: j: 0:
| start:0d i: 3: |
loop start i: 4: j: 0:
loop   end i: 4: |
| j:1|| basic|
| start:5
loop start i: 5: j: 1:
loop   end i: 5: |(| j:1|(| basic|
(| start:5
loop start i: 6: j: 1:
| start:5d i: 6: |
loop start i: 7: j: 1:
loop   end i: 7: |
| j:2|| basic|
| start:8
loop start i: 8: j: 2:
loop   end i: 8: |)| j:2|)| basic|
)| start:8
loop start i: 9: j: 2:
| start:8d i: 9: |
loop start i: 10: j: 2:
loop   end i: 10: |
| j:3|| basic|
| start:11
lines[0]|---|
lines[1]|(|
lines[2]|)|
lines[3]||
lines[4]||
lines[5]||
lines[6]||
lines[7]||
lines[8]||
lines[9]||

---

 

(20200710: https://github.com/WaitrudWeber/source_zip/blob/master/analyzer_20200703-001.zip)
compilation error: we think double file.

(20200713: compilation: ignore of stop:

https://github.com/WaitrudWeber/source_zip/blob/master/analyzer_20200713-001.zip)

 

(20200714: )

https://github.com/WaitrudWeber/source_zip/blob/master/analyzer_20200714-001.zip

 it doesn't stop and I put '<' double so that we could see compilation error: