Re: tai_pack doesn't give me the correct result

Greg Black <[email protected]> Wed, 26 Feb 2003 21:35:58 +1000
Newsgroups gmane.comp.lib.libtai
Message-ID <[email protected]>
Anand Buddhdev wrote:

| I'm a newbie C programmer, and I'm trying to learn how to use the TAI
| library. I wrote the following program to practice with:
| 
| #include <stdio.h>
| #include "caltime.h"
| #include "tai.h"
| 
| main() {
| 	struct caltime m;
| 	struct tai t;
| 	char s[TAI_PACK];
| 	int i;
| 
| 	caltime_scan("2003-02-25 12:00:00 +0000",&m);
| 	caltime_tai(&m,&t);
| 	tai_pack(s,&t);
| 	for (i=0; i < TAI_PACK; i++) printf("%02x ",s[i]);	
| 	printf("\n");
| }
| 
| 
| After I compile and run this, I get the following output:
| 
| 40 00 00 00 3e 5b 5a ffffffca
| 
| I can see that the first 7 bytes look correct, but I don't understand
| why the 8th byte looks wrong. Can anyone spot any obvious mistakes in
| my code, or my understanding of the TAI label?

You need to learn C so that you can avoid basic coding errors
like this -- that is not a topic for this list.

Greg