Packet.c
void packet_read(FILE* fp, packet* pkt) { // section b
	unsigned char* data_arr = NULL;
	int i = 0;
	// scan information of a line up to data length
	fscanf(fp, "%u %hhu %hhu %hhu %hhu", &pkt->Time, &pkt->Da, &pkt->Sa, &pkt->Prio, &pkt->Data_Length);

	// create array with size of length
	assert(data_arr = (unsigned char*)malloc(sizeof(unsigned char) * pkt->Data_Length)); 
	// scan data information into the array
	for (; i < pkt->Data_Length; i++) { 
		fscanf(fp, "%hhu", &data_arr[i]);
	}

	// add the array into the packet
	pkt->Data = data_arr;
	
	// scan checksum as the last information,
	// space in the end is meant to "eat up" the remaining '\n'
	fscanf(fp, "%hhu ", &pkt->Checksum);
}
// --- functions ---
/*reads packet information from a file and stores it in a packet structure*/
functions
reads packet information from a file and stores it in a packet structure
functions reads packet information from a file and stores it in a packet structure
void packet_read(FILE* fp, packet* pkt) { 
	unsigned char* data_arr = NULL;
	int i = 0;
	fscanf(fp, "%u %hhu %hhu %hhu %hhu", &pkt->Time, &pkt->Da, &pkt->Sa, &pkt->Prio, &pkt->Data_Length);
	assert(data_arr = (unsigned char*)malloc(sizeof(unsigned char) * pkt->Data_Length)); 
	for (; i < pkt->Data_Length; i++) { 
		fscanf(fp, "%hhu", &data_arr[i]);
	}
	pkt->Data = data_arr;
	fscanf(fp, "%hhu ", &pkt->Checksum);
}
void packet_read ( FILE * fp , packet * pkt ) { unsigned char * data_arr = NULL ; int i = 0 ; fscanf ( fp , " " , & pkt -> Time , & pkt -> Da , & pkt -> Sa , & pkt -> Prio , & pkt -> Data_Length ) ; assert ( data_arr = ( unsigned char * ) malloc ( sizeof ( unsigned char ) * pkt -> Data_Length ) ) ; for ( ; i < pkt -> Data_Length ; i ++ ) { fscanf ( fp , " " , & data_arr [ i ] ) ; } pkt -> Data = data_arr ; fscanf ( fp , " " , & pkt -> Checksum ) ; }
functions 
reads packet information from a file and stores it in a packet structure
functions reads packet information from a file and stores it in a packet structure
// section b
 // scan information of a line up to data length
 // create array with size of length
 // scan data information into the array
 // add the array into the packet
 // scan checksum as the last information,
 // space in the end is meant to "eat up" the remaining '\n'
