I don't think the segmentation fault comes due to logical errors, but pointing to un-initialized mem pages. In your case I think u forgot to initialize the pointer using malloc(). Pls try using
time_t *t = (time_t*) malloc(sizeof(time_t)); /* do get the time to t */ free(t); Bijoy. V -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hashir Sent: Tuesday, February 24, 2004 10:45 PM To: This List discusses GNU/Linux & GNU,GPL Software Subject: Re: [Mailinglist] diplay time with c/c++ ?????SEGMENTTN FLT Hello Am Still getting SEGMENTATION FAULT. Could some1 please tell me what Segmentation Fault means? I tried a diff approach and it worked fine. time_t t ; t = time( 0 ); printf ( " %s ", ctime(t)); Now it complied fine..Does Segmentation Fault occur only whn we use pointers???? Hav encountered SEG FLT many times..still havg no idea what it is!!! Thankz a LOT hashir > On Mon, Feb 23, 2004 at 10:22:18AM -0800, Muhammed sabir wrote: > > > > i think u have to change "%s" with "%,24s" > > time_t *t ; > > > time(t); > > > printf("%,24s\r\n" ,ctime(t)); > > remove the coma after the %. > > printf(%24s\r\n", ctime(t)); > > with regards > M.Balakrishna Pillai > _______________________________________________ Mailinglist mailing list [email protected] http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org
