Sender: nate AT cartsys DOT com Message-ID: <374B1D12.7C97777E@cartsys.com> Date: Tue, 25 May 1999 14:58:42 -0700 From: Nate Eldredge X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.5 i586) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: srand() or time() References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Dlanor Blytkerchan wrote: > > Hi all! > > Here's a weird little fact (not a real problem, but weird notheless): > The following code results in an error: > > #include > #include > > int main(void) { > srand(time(0)); > return(0); > } // main() > > When stepping through this in RHIDE, watching errno like a hawk, immediatly > after srand(time(0)); errno is set to 22 (ENOENT) (and thus causes my > program to believe there's an error, which it wisely ignores). > Is there anything I'm missing here, or is this just some weird frill in the > RNG or the time()? It shouldn't happen, AFAIK. But I think I may know why it does. * What DJGPP version is this? * Do you have the timezone files installed (what is in your zoneinfo/ directory)? Try finding out exactly where it is changing. In GDB, you might set a watchpoint. E.g. gcc -g -o foo.exe foo.c gdb foo.exe break main run watch errno c bt and send back what it prints. -- Nate Eldredge nate AT cartsys DOT com