Mail Archives: djgpp/1999/05/25/17:54:42
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 <time.h>
> #include <stdlib.h>
>
> 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
- Raw text -