TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Paul Markham
from: Bob Lawrence
date: 1996-12-03 09:58:36
subject: posix

PM> Yes, strftime() takes a tm struct, so all you need to do is
 PM> convert the time_t variable to a tm struct using localtime()
 PM> and the pass it to strftime(). You can use something like: 

  So Paul *finally* told me... after I'd written my own version of
localtime().
  
 PM> int main(void)
 PM> {
 PM> struct stat s;
 PM> char        buff[20];
 PM> 
 PM> stat("c:\\config.sys", &s);
 PM> strftime(buff, sizeof(buff), "%d-%m-%y",
localtime(&s.st_ctime));
 PM> printf(buff);
 PM> 
 PM> return(EXIT_SUCCESS);
 PM> }

  Where have I seen something very like that..?  :-)

 BL> I assume that means if I set the compiler to ANSI and press the
 BL> button, the EXE I get won't work on UNIX?

 PM> The EXE you generate under DOS won't work under UNIX. What you
 PM> can do is to copy your source code to a UNIX system and
 PM> recompile it there without having to change your code.

  Oh. 

 BL> I read that Borland is about to release Delphi for C, so I
 BL> thought I'd give C another run in light of my greatly advanced
 BL> knowledge of Pascal.

 PM> Since Delphi is Pascal, I've got no idea what Delphi for C is!

  Delphi is two things, the VB-like approach to event programming, and
the l;anguage. In fact, Delphi2 is very close to C already. I think it
actually uses the same compiler.

 BL>   qsort(list, n, 80, sort);
 PM> ^^^^
 PM> 
 PM> If you're trying to sort using pointers, defining the element length
 PM> as 80 is wrong. You need to define it as the length of a pointer:
 PM> 
 PM> qsort(list, n, sizeof(list[0]), sort);

  That doesn't work either. Have you actually tried it? 

  If I do that and look at what is fed to the compare function it's
garbage. I need a way for the compare function to know what the
pointer means... and how can it?

Regards,
Bob
___ Blue Wave/QWK v2.12
@EOT:

---
* Origin: Precision Nonsense, Sydney (3:711/934.12)
SEEN-BY: 711/934 712/610
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.