Waitrud Weber’s blog

things and reminders for memories

windows-make: read a file in C.

24 itself is not in the alphabet.
We can read it by a character buffer.

 

char c_memory_allocation[255];
//https://qiita.com/satken2/items/d14b4113fe3fb5f5597b
//https://en.wikipedia.org/wiki/MPEG-4_Part_14
int read_mp4_005 (char* filename ) {
	FILE *fp;
	char b_dummy[256];
	int i, j ;
	int file_end;
	STRUCT_FILE structure_fp;
	char c;
	char* p_dummy = NULL;
	char* p_dummy_token = NULL;
	int canread;
	char* block_string;
	int b_index = 0;
	char w_filename[255];
	int index = 0;
	int col = 0;
	char* typeofkey[3] = { "ftyp", "mdat", "moovt" };
	int m = 0;

	printf("int read_mp4 (char* filename ) starts.\r\n");

	fp = fopen(filename, "rb");
	structure_fp.file_start = fp;
	structure_fp.fp = fp;

	file_end = filesize(fp);
	structure_fp.file_end_index = file_end;

	canread = 1;
	int ini = initialize_parse ();

	// Lootn check if we set 100 to the text file.
	fread ( c_memory_allocation, 1, 4, structure_fp.fp );

	for ( i=0; i<4; i++ ) {
		printf("i:%04d char %04d\r\n", i, c_memory_allocation[i] );
	}

	fclose ( structure_fp.fp );

//	aFree ( p_dummy_token );

	printf("int read_mp4 (char* filename ) ends.\r\n"); 
	return 0;
}

> .\winmain_001.exe .\SANY6907.MP4
 argc[i] filename = .\SANY6907.MP4
int read_mp4 (char* filename ) starts.
int initialize_parse () starts.
int initialize_parse () ends.
i:0000 char 0000 | |
i:0001 char 0000 | |
i:0002 char 0000 | |
i:0003 char 0024 | |
int read_mp4 (char* filename ) ends.
void print_memories () starts.
void print_memories () ends.

 

download: 

https://github.com/WaitrudWeber/source_zip/blob/master/mp4_20210915.zip

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

willinglytranslate.blogspot.com