delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/25/14:39:56

X-Sender: dlanor AT mail DOT dds DOT nl
Message-Id: <l03130304b36f36eea8f5@[145.98.116.154]>
Mime-Version: 1.0
Date: Mon, 24 May 1999 19:08:35 +0200
To: djgpp AT delorie DOT com
From: Dlanor Blytkerchan <dlanor AT dds DOT nl>
Subject: srand() or time()
Reply-To: djgpp AT delorie DOT com

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()?

Greetz!

Dlanor


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019