[ create a new paste ] login | about

Link: http://codepad.org/MslAa67a    [ raw code | output | fork ]

C, pasted on Nov 8:
int main(void)
{
	// envoi
	unsigned short hh = 10;
	unsigned short mm = 19;
	unsigned short ss = 38;

	char paquet[6];
	sprintf( paquet, "<%c%c%c>", hh, mm, ss );
	printf( "encodé: %s\n", paquet );
	
	// reception
	hh = 0;
	mm = 0;
	ss = 0;
	if ( sscanf( paquet, "<%c%c%c>", &hh, &mm, &ss) == 3 )
	{
		printf("décodé: %hhu:%hhu:%hhu\n", hh, mm, ss);
	}
	
	return 0;
}


Output:
1
2
3
encodé: <
&>
décodé: 10:19:38


Create a new paste based on this one


Comments: