Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #395879 > unrolled thread
| Started by | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| First post | 2025-12-22 08:48 +0000 |
| Last post | 2026-01-08 02:57 +0000 |
| Articles | 20 on this page of 185 — 25 participants |
Back to article view | Back to comp.lang.c
srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-22 08:48 +0000
Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-22 06:44 -0500
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-22 13:18 +0100
Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-22 12:13 -0500
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-22 18:41 +0100
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-22 20:45 +0200
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-22 21:16 +0000
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-22 22:19 +0100
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-22 22:57 +0100
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-23 11:18 +0200
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-23 10:54 +0100
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-23 13:50 +0200
Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-23 18:29 -0500
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-23 16:30 -0800
Re: srand(0) antispam@fricas.org (Waldek Hebisch) - 2025-12-23 17:54 +0000
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-24 00:08 +0200
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-24 02:02 +0000
Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2025-12-23 23:43 -0500
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-24 05:34 +0000
Re: srand(0) antispam@fricas.org (Waldek Hebisch) - 2025-12-24 09:00 +0000
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-24 12:12 +0200
Article of Melissa O'Nail (Was: srand(0)) Michael S <already5chosen@yahoo.com> - 2025-12-28 02:44 +0200
Re: Article of Melissa O'Nail antispam@fricas.org (Waldek Hebisch) - 2025-12-28 05:38 +0000
Re: Article of Melissa O'Nail Michael S <already5chosen@yahoo.com> - 2025-12-28 12:35 +0200
Re: Article of Melissa O'Nail Michael S <already5chosen@yahoo.com> - 2026-01-05 14:21 +0200
Re: Article of Melissa O'Nail antispam@fricas.org (Waldek Hebisch) - 2026-01-07 10:51 +0000
Re: Article of Melissa O'Nail Michael S <already5chosen@yahoo.com> - 2026-01-08 14:03 +0200
Re: Article of Melissa O'Nail Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-08 09:40 -0800
Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-08 09:26 -0800
Re: srand(0) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-12-24 13:48 -0800
Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-07 08:41 -0800
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-08 01:06 +0200
Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-02-03 05:26 -0800
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-02-03 16:37 +0200
Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-02-17 23:47 -0800
Re: srand(0) Tristan Wibberley <tristan.wibberley+netnews2@alumni.manchester.ac.uk> - 2026-02-18 11:21 +0000
Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-19 10:01 +0100
Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-02-19 14:33 -0500
Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-19 20:47 +0100
Re: srand(0) James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-02-20 16:01 -0500
Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-21 11:09 +0100
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-02-19 14:39 -0800
Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-20 09:16 +0100
Re: srand(0) Paul <nospam@needed.invalid> - 2026-02-23 08:32 -0500
Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-23 16:05 +0100
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-02-23 19:59 +0200
Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-23 20:06 +0100
Re: srand(0) Paul <nospam@needed.invalid> - 2026-02-23 15:24 -0500
Re: srand(0) Axel Reichert <mail@axel-reichert.de> - 2026-02-24 07:08 +0100
Re: srand(0) David Brown <david.brown@hesbynett.no> - 2026-02-24 10:24 +0100
Re: srand(0) Axel Reichert <mail@axel-reichert.de> - 2026-02-26 19:13 +0100
Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-24 05:22 -0600
Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-24 23:09 -0600
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-25 09:51 +0100
Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-25 04:24 -0600
Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-07 07:50 -0800
Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-07 07:46 -0800
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-07 18:14 +0200
Re: srand(0) Kaz Kylheku <046-301-5902@kylheku.com> - 2025-12-22 19:16 +0000
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-22 22:35 +0100
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 07:24 +0000
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-23 09:59 +0100
Re: srand(0) Michael Bäuerle <michael.baeuerle@stz-e.de> - 2025-12-23 11:09 +0100
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 14:49 +0000
Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2025-12-23 16:13 +0000
Re: srand(0) richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-12-23 19:05 +0000
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-23 02:16 -0800
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 14:47 +0000
Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2025-12-23 16:08 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 15:44 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 07:17 +0000
Re: srand(0) David Brown <david.brown@hesbynett.no> - 2025-12-23 08:25 +0100
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 14:45 +0000
Re: srand(0) David Brown <david.brown@hesbynett.no> - 2025-12-23 19:15 +0100
Re: srand(0) John McCue <jmclnx@gmail.com.invalid> - 2025-12-23 00:39 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-23 02:17 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 14:55 +0000
Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-24 23:35 -0600
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-26 08:23 +0000
Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-26 14:48 -0600
Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-26 15:12 -0600
Re: srand(0) Ike Naar <ike@sdf.org> - 2025-12-23 06:49 +0000
Re: srand(0) John McCue <jmclnx@gmail.com.invalid> - 2025-12-23 20:37 +0000
Re: srand(0) Ike Naar <ike@sdf.org> - 2025-12-24 15:22 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-23 07:25 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-24 06:16 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 15:21 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-24 19:00 +0000
Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-25 03:07 -0600
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-25 19:31 +0000
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-25 21:14 +0100
Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-25 15:29 -0600
Re: srand(0) Paul <nospam@needed.invalid> - 2025-12-25 23:25 -0500
Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-25 23:41 -0600
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-26 05:42 +0000
Re: srand(0) Paul <nospam@needed.invalid> - 2025-12-26 01:52 -0500
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-26 07:56 +0000
Re: srand(0) BGB <cr88192@gmail.com> - 2025-12-26 04:48 -0600
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-24 10:51 +0200
Re: srand(0) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-12-24 00:59 -0800
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 15:28 +0000
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-24 17:44 +0200
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 16:17 +0000
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-24 17:53 +0100
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 17:27 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 17:33 +0000
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-24 20:16 +0200
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-25 02:01 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-25 03:17 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-26 08:13 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-25 04:30 +0000
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-25 09:10 +0100
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-26 08:08 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-30 06:07 +0000
Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2025-12-30 18:42 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-31 02:01 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 03:10 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-31 03:28 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 09:37 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-01 07:32 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-01 19:02 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-01 19:20 +0000
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-01 21:53 +0200
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-01 23:50 +0000
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-02 14:32 +0200
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-02 16:18 +0200
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-02 20:52 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-02 20:46 +0000
Re: srand(0) Mike Terry <news.dead.person.stones@darjeeling.plus.com> - 2026-01-03 04:08 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-03 04:39 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-03 14:24 +0000
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-03 20:38 +0200
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-30 19:37 -0800
Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2025-12-31 17:24 +0000
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 15:17 -0800
Re: srand(0) Paul <nospam@needed.invalid> - 2025-12-31 12:30 -0500
Re: srand(0) bart <bc@freeuk.com> - 2025-12-31 18:42 +0000
Re: srand(0) Paul <nospam@needed.invalid> - 2025-12-31 15:07 -0500
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-31 22:18 +0200
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 20:55 +0000
Re: srand(0) bart <bc@freeuk.com> - 2025-12-31 22:57 +0000
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 16:00 -0800
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-01 01:03 +0000
Re: srand(0) bart <bc@freeuk.com> - 2026-01-01 14:05 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-01 19:03 +0000
Re: srand(0) bart <bc@freeuk.com> - 2026-01-01 20:28 +0000
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 15:29 -0800
Re: srand(0) highcrew <high.crew3868@fastmail.com> - 2026-01-01 00:31 +0100
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 16:05 -0800
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-31 15:29 +0200
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 20:52 +0000
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 15:14 -0800
Re: srand(0) Geoff <geoff@invalid.invalid> - 2026-01-05 20:00 -0800
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 15:03 -0800
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-30 19:35 -0800
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-31 04:51 +0000
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2025-12-31 15:15 +0200
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-31 20:51 +0000
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 15:00 -0800
Re: srand(0) Michael S <already5chosen@yahoo.com> - 2026-01-01 01:45 +0200
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 16:34 -0800
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-01 07:23 +0000
Re: srand(0) Mike Terry <news.dead.person.stones@darjeeling.plus.com> - 2026-01-01 02:01 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-01-01 02:29 +0000
Re: srand(0) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-30 06:34 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-30 14:05 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-28 05:51 +0000
Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2025-12-24 17:08 +0000
Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-07 07:39 -0800
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-01-07 13:54 -0800
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-08 15:34 +0000
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-01-08 14:44 -0800
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-09 06:06 +0000
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-01-08 22:46 -0800
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-09 22:38 +0000
Re: srand(0) scott@slp53.sl.home (Scott Lurndal) - 2026-01-09 23:27 +0000
Re: srand(0) Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-01-09 17:09 -0800
Re: srand(0) Kaz Kylheku <046-301-5902@kylheku.com> - 2026-01-10 19:44 +0000
Re: srand(0) Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-01-09 00:36 -0800
Re: srand(0) Bonita Montero <Bonita.Montero@gmail.com> - 2025-12-23 11:04 +0100
Re: srand(0) "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2025-12-23 21:44 -0800
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-24 15:41 +0000
Re: srand(0) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-24 18:04 +0100
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2025-12-25 05:41 +0000
Re: srand(0) Michael Sanders <porkchop@invalid.foo> - 2026-01-08 02:57 +0000
Page 6 of 10 — ← Prev page 1 … 4 5 [6] 7 8 … 10 Next page →
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-24 15:28 +0000 |
| Message-ID | <10ih0qo$13hnn$2@dont-email.me> |
| In reply to | #395933 |
On Wed, 24 Dec 2025 10:51:14 +0200, Michael S wrote: > On Tue, 23 Dec 2025 07:25:42 -0000 (UTC) > Michael Sanders <porkchop@invalid.foo> wrote: > >> On Tue, 23 Dec 2025 00:39:49 -0000 (UTC), John McCue wrote: >> >> > I like to just read /dev/urandom when I need a random >> > number. Seem easier and more portable across Linux & >> > the *BSDs. >> > >> > int s; >> > read(fd, &s, sizeof(int)); >> >> Thanks John. Wish there was such a 'device' under Windows... >> > > There is. > Windows XP/Vista/7: > https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom > Win8 and later: > https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom Was referring to the concept of a device in the same idiom of BSD/Linux/Apple... Something that is just as easy to use. -- :wq Mike Sanders
[toc] | [prev] | [next] | [standalone]
| From | Michael S <already5chosen@yahoo.com> |
|---|---|
| Date | 2025-12-24 17:44 +0200 |
| Message-ID | <20251224174452.00003278@yahoo.com> |
| In reply to | #395944 |
On Wed, 24 Dec 2025 15:28:24 -0000 (UTC) Michael Sanders <porkchop@invalid.foo> wrote: > On Wed, 24 Dec 2025 10:51:14 +0200, Michael S wrote: > > > On Tue, 23 Dec 2025 07:25:42 -0000 (UTC) > > Michael Sanders <porkchop@invalid.foo> wrote: > > > >> On Tue, 23 Dec 2025 00:39:49 -0000 (UTC), John McCue wrote: > >> > >> > I like to just read /dev/urandom when I need a random > >> > number. Seem easier and more portable across Linux & > >> > the *BSDs. > >> > > >> > int s; > >> > read(fd, &s, sizeof(int)); > >> > >> Thanks John. Wish there was such a 'device' under Windows... > >> > > > > There is. > > Windows XP/Vista/7: > > https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom > > Win8 and later: > > https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom > > > > Was referring to the concept of a device in the same idiom of > BSD/Linux/Apple... > > Something that is just as easy to use. > What is not easy in the functions referred above? You do the same couple of steps as on Unix: open device then read few bytes from it. Only names are different.
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-24 16:17 +0000 |
| Message-ID | <10ih3lu$13hnn$5@dont-email.me> |
| In reply to | #395947 |
On Wed, 24 Dec 2025 17:44:52 +0200, Michael S wrote:
> On Wed, 24 Dec 2025 15:28:24 -0000 (UTC)
> Michael Sanders <porkchop@invalid.foo> wrote:
>
>> On Wed, 24 Dec 2025 10:51:14 +0200, Michael S wrote:
>>
>> > On Tue, 23 Dec 2025 07:25:42 -0000 (UTC)
>> > Michael Sanders <porkchop@invalid.foo> wrote:
>> >
>> >> On Tue, 23 Dec 2025 00:39:49 -0000 (UTC), John McCue wrote:
>> >>
>> >> > I like to just read /dev/urandom when I need a random
>> >> > number. Seem easier and more portable across Linux &
>> >> > the *BSDs.
>> >> >
>> >> > int s;
>> >> > read(fd, &s, sizeof(int));
>> >>
>> >> Thanks John. Wish there was such a 'device' under Windows...
>> >>
>> >
>> > There is.
>> > Windows XP/Vista/7:
>> > https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom
>> > Win8 and later:
>> > https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
>> >
>>
>> Was referring to the concept of a device in the same idiom of
>> BSD/Linux/Apple...
>>
>> Something that is just as easy to use.
>>
>
> What is not easy in the functions referred above? You do the same
> couple of steps as on Unix: open device then read few bytes from it.
> Only names are different.
Depends the toolkit no?
Unix:
$ head -c 8 /dev/urandom | od -An | tr -d ' '
4fa2c3d17b9a8f12
Windows:
PS C:\Users\Bob>
$bytes = New-Object byte[] 8
[System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
[Console]::Write($bytes | ForEach-Object { "{0:x2}" -f $_ })
--
:wq
Mike Sanders
es
[toc] | [prev] | [next] | [standalone]
| From | Janis Papanagnou <janis_papanagnou+ng@hotmail.com> |
|---|---|
| Date | 2025-12-24 17:53 +0100 |
| Message-ID | <10ih5r2$25ihh$5@dont-email.me> |
| In reply to | #395948 |
On 2025-12-24 17:17, Michael Sanders wrote:
>
> Unix:
> $ head -c 8 /dev/urandom | od -An | tr -d ' '
> 4fa2c3d17b9a8f12
>
> Windows:
> PS C:\Users\Bob>
> $bytes = New-Object byte[] 8
> [System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
> [Console]::Write($bytes | ForEach-Object { "{0:x2}" -f $_ })
Amazing! 8-o
Or rather; frightening! ("The little Shop of Horrors")
A mixture (best/worst) of all; OO, Functional, and Shell?
What is that; "Powershell", or something else?
(I've mostly ignored Windows during the past 20+ years.)
Janis
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-24 17:27 +0000 |
| Message-ID | <10ih7q4$1895q$1@dont-email.me> |
| In reply to | #395949 |
On Wed, 24 Dec 2025 17:53:54 +0100, Janis Papanagnou wrote:
> On 2025-12-24 17:17, Michael Sanders wrote:
>>
>> Unix:
>> $ head -c 8 /dev/urandom | od -An | tr -d ' '
>> 4fa2c3d17b9a8f12
>>
>> Windows:
>> PS C:\Users\Bob>
>> $bytes = New-Object byte[] 8
>> [System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
>> [Console]::Write($bytes | ForEach-Object { "{0:x2}" -f $_ })
>
> Amazing! 8-o
>
> Or rather; frightening! ("The little Shop of Horrors")
> A mixture (best/worst) of all; OO, Functional, and Shell?
>
> What is that; "Powershell", or something else?
> (I've mostly ignored Windows during the past 20+ years.)
>
> Janis
Yes its Powershell. You nailed it spot on IMO its terrible Janis.
*Speaking only for myself* it's: thick/crufty/oop/functional/shell
all mashed together like sludge. Awful stuff.
And plain old 'cmd.exe' (more or less the Windows equivalent
of /bin/sh) has evolved oddly too with all its 'syntactical sugar'...
witness: echo hello world? | | tr 'A-Za-z' 'N-ZA-Mn-za-m'
vs.: <https://rosettacode.org/wiki/Rot-13#Batch_File>
I'm breaking free from it =)
This tool helps: <https://frippery.org/busybox/>
--
:wq
Mike Sanders
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-24 17:33 +0000 |
| Message-ID | <10ih853$18on4$1@dont-email.me> |
| In reply to | #395953 |
On Wed, 24 Dec 2025 17:27:32 -0000 (UTC), Michael Sanders wrote: > witness: echo hello world? | | tr 'A-Za-z' 'N-ZA-Mn-za-m' typo, should be: echo hello world? | tr 'A-Za-z' 'N-ZA-Mn-za-m' -- :wq Mike Sanders
[toc] | [prev] | [next] | [standalone]
| From | Michael S <already5chosen@yahoo.com> |
|---|---|
| Date | 2025-12-24 20:16 +0200 |
| Message-ID | <20251224201622.000017d1@yahoo.com> |
| In reply to | #395955 |
On Wed, 24 Dec 2025 17:33:23 -0000 (UTC) Michael Sanders <porkchop@invalid.foo> wrote: > On Wed, 24 Dec 2025 17:27:32 -0000 (UTC), Michael Sanders wrote: > > > witness: echo hello world? | | tr 'A-Za-z' 'N-ZA-Mn-za-m' > > typo, should be: echo hello world? | tr 'A-Za-z' 'N-ZA-Mn-za-m' > I agree that Powershell is too complicated and too "wannabe real programming language" which makes it bad shell scripting language. Esp. so for quick throwaway scripts. However I don't quite understand what you find wrong with cmd.exe. Cryptic? May be. But I can not imagine shell scripting language which is not cryptic in some way. Has few limitations that one would not expect in shell script in 2025? Yes. C:>set a= 1000000 C:>set /A ab= %a% * 1000 1000000000 C:>set /A ab= %a% * 2000 2000000000 C:>set /A ab= %a% * 3000 -1294967296 But cmd.exe language certainly is *not* over-complicated. Rather more like too primitive.
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-25 02:01 +0000 |
| Message-ID | <10ii5t6$1gu1h$1@dont-email.me> |
| In reply to | #395956 |
On Wed, 24 Dec 2025 20:16:22 +0200, Michael S wrote:
> I agree that Powershell is too complicated and too "wannabe real
> programming language" which makes it bad shell scripting language.
> Esp. so for quick throwaway scripts.
>
> However I don't quite understand what you find wrong with cmd.exe.
> Cryptic? May be. But I can not imagine shell scripting language which is
> not cryptic in some way.
> Has few limitations that one would not expect in shell script in 2025?
> Yes.
> C:>set a= 1000000
> C:>set /A ab= %a% * 1000
> 1000000000
> C:>set /A ab= %a% * 2000
> 2000000000
> C:>set /A ab= %a% * 3000
> -1294967296
>
> But cmd.exe language certainly is *not* over-complicated. Rather more
> like too primitive.
Complicated doesn't quite capture the zeitgeist, closer to obtuse,
or baroque. An example below of a valid block that makes Perl look
good... Notice for instance the alternate use of set compared to
your example.
yours: set [option] var = assignment
below: set "var = assignment"
Not to mention some other quirks. But that's just my opinion.
@echo off
cd /d "%~dp0"
>nul chcp 65001
set "_MediaInfo=C:\Program Files\MediaInfo\MediaInfo.exe"
for /f ^usebackq^delims^= %%G in =;(` "%__AppDir__%where.exe" .:v*.mpg `);= do for /f usebackq^delims^= %%i in =;(`
call "%_MediaInfo%" --inform^^^=Video^^^;^^^%%Height^^^%% "%%~fG" `);= do rename "%%~fG" "%%~nG-%%~ip%%~xG"
>nul chcp 437
--
:wq
Mike Sanders
[toc] | [prev] | [next] | [standalone]
| From | Lawrence D’Oliveiro <ldo@nz.invalid> |
|---|---|
| Date | 2025-12-25 03:17 +0000 |
| Message-ID | <10iiacl$1iv7u$1@dont-email.me> |
| In reply to | #395959 |
On Thu, 25 Dec 2025 02:01:11 -0000 (UTC), Michael Sanders wrote: > Not to mention some other quirks. But that's just my opinion. Nothing specific to either cmd.exe or PowerShell, but the Windows command line is fundamentally broken. This is because it derives from the CP/M command line model, which in turn was inherited from old-time DEC operating systems. On these DEC systems, the command line was a simple string buffer. So there is this assumption that program invocation is always going to be mediated by some kind of “shell” program, and the concept of one program directly invoking another is either nonexistent, or only grudgingly tolerated. Contrast this with the Unix approach, where the command line is an array of separate string “words”. There is no “shell” that occupies a privileged place in the system; any program can directly invoke any other, without having to worry about properly escaping any special characters that might be (mis)interpreted by some “shell”.
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-26 08:13 +0000 |
| Message-ID | <10ilg3i$2fs21$2@dont-email.me> |
| In reply to | #395960 |
On Thu, 25 Dec 2025 03:17:41 -0000 (UTC), Lawrence D’Oliveiro wrote: > Nothing specific to either cmd.exe or PowerShell, but the Windows > command line is fundamentally broken. This is because it derives from > the CP/M command line model, which in turn was inherited from old-time > DEC operating systems. > > On these DEC systems, the command line was a simple string buffer. So > there is this assumption that program invocation is always going to be > mediated by some kind of “shell” program, and the concept of one > program directly invoking another is either nonexistent, or only > grudgingly tolerated. > > Contrast this with the Unix approach, where the command line is an > array of separate string “words”. There is no “shell” that occupies a > privileged place in the system; any program can directly invoke any > other, without having to worry about properly escaping any special > characters that might be (mis)interpreted by some “shell”. Bingo - you nailed it in my mind. To be sure, when in Windows you have to play by their rules as Michael S. more or less pointed out. Given a choice, I'm seeking stiller waters with the odd exception here & there. Its all good =) -- :wq Mike Sanders
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-25 04:30 +0000 |
| Message-ID | <10iiell$1kfhj$1@dont-email.me> |
| In reply to | #395949 |
On Wed, 24 Dec 2025 17:53:54 +0100, Janis Papanagnou wrote: > [...] Ok seed is working for replaying a game. =) Pure C, no ncurses etc, built in help too. You know this game don't you Janis? Simple little project. Screenshot... <https://drive.google.com/file/d/1dKSjDzmu0mLy76GWrlZUT9HVK72GiP9d/view> -- :wq Mike Sanders
[toc] | [prev] | [next] | [standalone]
| From | Janis Papanagnou <janis_papanagnou+ng@hotmail.com> |
|---|---|
| Date | 2025-12-25 09:10 +0100 |
| Message-ID | <10iirh8$25ihh$6@dont-email.me> |
| In reply to | #395961 |
On 2025-12-25 05:30, Michael Sanders wrote: > > Ok seed is working for replaying a game. =) > Pure C, no ncurses etc, built in help too. How did you implement the colored squares? Using characters from an "extended" character set and ANSI controls for the colors? > You know this game don't you Janis? > Simple little project. Screenshot... > > <https://drive.google.com/file/d/1dKSjDzmu0mLy76GWrlZUT9HVK72GiP9d/view> Looks nice.[*] Only that it looks as if one gets too much information (compared to the original Mastermind)! IMO and AFAIK one should *not* get the _exact_ place of a wrong digit indicated. (The green hints should all be left aligned, and the [optional] red ones all right aligned, and the blue ones in between.) Janis [*] 18 months ago I've written an optically less appealing command line variant to refresh my Algol 68 skills. Though I just notice that I hadn't finish it yet; I've only implemented playing modes 1 and 2. ;-) Enter a value for #places: 4 Enter a value for #colors: 6 Available playing modes: 1 - computer selects, human guesses 2 - human selects, computer guesses 3 - alternate select/guess roles per game 4 - human selects, human guesses 5 - computer selects, computer guesses 0 - leave the game Choose the playing mode (1-5): 1 A secret color combination to guess has been chosen. You have to guess it. Enter a color combination: 1122 Turn 1: 1 1 2 2 - Enter a color combination: 3345 Turn 2: 3 3 4 5 - @ Enter a color combination: 6444 Turn 3: 6 4 4 4 - @@ Enter a color combination: 6646 Turn 4: 6 6 4 6 - @@@@ You guessed it!
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-26 08:08 +0000 |
| Message-ID | <10ilfqp$2fs21$1@dont-email.me> |
| In reply to | #395966 |
On Thu, 25 Dec 2025 09:10:16 +0100, Janis Papanagnou wrote:
> How did you implement the colored squares? Using characters from
> an "extended" character set and ANSI controls for the colors?
Yes exactly. I do have a fallback for older terminal emulators:
void set_utf(void) {
const char *env = getenv("MASTERMIND");
UTF = (env && env[0] == '0' && env[1] == '\0') ? 0 : 1;
}
if (UTF) static const char *glyph_utf[] = { ... }; // unicode
else static const char *glyph_xyz[] = { ... }; // ascii
Check out <https://jrgraphix.net/r/Unicode/2500-257F>
Lots of useful glyphs there. Assuming the reader's software can
render these, here's some tree glyphs that provide a smart visual
representation of branching hierarchical taxonomies. For instance,
if the next number in the sequence is larger than its mother node,
attach to that node, else climb the tree till the next mother node
& seek attachment there...
195, 510, 855, 1380, 25, 170
195
├─510
│ └─855
│ └─1380
└─25
└─170
Very handy for sorting things given certain contexts.
> Looks nice.[*]
Thanks
> Only that it looks as if one gets too much information (compared
> to the original Mastermind)! IMO and AFAIK one should *not* get
> the _exact_ place of a wrong digit indicated. (The green hints
> should all be left aligned, and the [optional] red ones all right
> aligned, and the blue ones in between.)
Yes it's just a variant. I still need to merge/harmonize
this new way (popular with some folks here in the U.S.)
with the older 'proper' way you & I learned it.
> [*] 18 months ago I've written an optically less appealing command
> line variant to refresh my Algol 68 skills. Though I just notice
> that I hadn't finish it yet; I've only implemented playing modes 1
> and 2. ;-)
>
>
> Enter a value for #places: 4
> Enter a value for #colors: 6
>
> Available playing modes:
> 1 - computer selects, human guesses
> 2 - human selects, computer guesses
> 3 - alternate select/guess roles per game
> 4 - human selects, human guesses
> 5 - computer selects, computer guesses
> 0 - leave the game
> Choose the playing mode (1-5): 1
>
> A secret color combination to guess has been chosen.
> You have to guess it.
>
> Enter a color combination: 1122
> Turn 1: 1 1 2 2 -
> Enter a color combination: 3345
> Turn 2: 3 3 4 5 - @
> Enter a color combination: 6444
> Turn 3: 6 4 4 4 - @@
> Enter a color combination: 6646
> Turn 4: 6 6 4 6 - @@@@
>
> You guessed it!
D*mn! Chuckle, that's 'god-mode' Janis, I could probably
play 5 colors at say 6, no make that 7 chances, but after
that, my brain begins to melt. =)
--
:wq
Mike Sanders
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-30 06:07 +0000 |
| Message-ID | <10ivq6b$1j8r3$1@dont-email.me> |
| In reply to | #395981 |
On Fri, 26 Dec 2025 08:08:57 -0000 (UTC), Michael Sanders wrote:
> Yes it's just a variant. I still need to merge/harmonize
> this new way (popular with some folks here in the U.S.)
> with the older 'proper' way you & I learned it.
Merged & harmonized...
int main(int argc, char *argv[]) {
// if app named 'moo' play bulls & cows else mastermind
const char *p = strrchr(argv[0], '/');
p = p ? p + 1 : argv[0];
MOO = (strcmp(p, "moo") == 0) ? 1 : 0;
int s = play(get_seed(argc, argv));
fflush(stdout);
fprintf(stderr, "%d\n", s);
return 0;
}
--
:wq
Mike Sanders
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2025-12-30 18:42 +0000 |
| Message-ID | <q2V4R.913844$ACS3.500160@fx17.iad> |
| In reply to | #396016 |
Michael Sanders <porkchop@invalid.foo> writes:
>On Fri, 26 Dec 2025 08:08:57 -0000 (UTC), Michael Sanders wrote:
>
>> Yes it's just a variant. I still need to merge/harmonize
>> this new way (popular with some folks here in the U.S.)
>> with the older 'proper' way you & I learned it.
>
>Merged & harmonized...
>
>int main(int argc, char *argv[]) {
>
> // if app named 'moo' play bulls & cows else mastermind
> const char *p = strrchr(argv[0], '/');
What if 'argv[0]' is NULL (and argc == 0)?
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-31 02:01 +0000 |
| Message-ID | <10j206j$27s3j$1@dont-email.me> |
| In reply to | #396019 |
On Tue, 30 Dec 2025 18:42:30 GMT, Scott Lurndal wrote:
> What if 'argv[0]' is NULL (and argc == 0)?
Well, seems we have to make a choice, ISO vs. POSIX:
*ISO C (C17 / C23)*:
C17, 5.1.2.2.1 "Program startup"
The value of argc shall be nonnegative.
argv[argc] shall be a null pointer.
If the value of argc is greater than zero, the array members argv[0]
through argv[argc−1] inclusive shall contain pointers to strings
which are given implementation-defined values.
int main(int argc, char *argv[]) {
// if app named 'moo' play bulls & cows else mastermind
const char *p = (argc > 0 && argv && argv[0]) ? argv[0] : "";
const char *s = strrchr(p, '/');
p = s ? s + 1 : p;
MOO = (strcmp(p, "moo") == 0) ? 1 : 0;
...
return 0;
}
*POSIX.1-2017 (and later)*
POSIX execve() specification:
The argument argv is an array of character pointers
to null-terminated strings.
The application shall ensure that argv[0] points to a filename
string that is associated with the process being started.
int main(int argc, char *argv[]) {
// if app named 'moo' play bulls & cows else mastermind
const char *p = strrchr(argv[0], '/');
p = p ? p + 1 : argv[0];
MOO = (strcmp(p, "moo") == 0) ? 1 : 0;
...
return 0;
}
What say you?
--
:wq
Mike Sanders
[toc] | [prev] | [next] | [standalone]
| From | Lawrence D’Oliveiro <ldo@nz.invalid> |
|---|---|
| Date | 2025-12-31 03:10 +0000 |
| Message-ID | <10j247s$2925s$3@dont-email.me> |
| In reply to | #396020 |
On Wed, 31 Dec 2025 02:01:55 -0000 (UTC), Michael Sanders wrote: > *ISO C (C17 / C23)*: > > C17, 5.1.2.2.1 "Program startup" > > The value of argc shall be nonnegative. > > argv[argc] shall be a null pointer. > > If the value of argc is greater than zero, the array members argv[0] > through argv[argc−1] inclusive shall contain pointers to strings > which are given implementation-defined values. > > ... > > What say you? Clearly on Windows, there are no guarantees about argc contains, so you shouldn’t be relying on it.
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2025-12-31 03:28 +0000 |
| Message-ID | <10j2583$29ge5$1@dont-email.me> |
| In reply to | #396021 |
On Wed, 31 Dec 2025 03:10:52 -0000 (UTC), Lawrence D’Oliveiro wrote:
> Clearly on Windows, there are no guarantees about argc contains, so
> you shouldn’t be relying on it.
Some windows snippets:
int main(int argc, char **argv); // subsystem (text-mode)
int wmain(int argc, wchar_t **argv); // gui
And to muddy the waters further (what I tend to use)...
#include <windows.h>
#include <stdio.h>
int main(void) {
LPSTR cmd = GetCommandLineA();
printf("Raw command line:\n%s\n", cmd);
return 0;
}
c:\> app.exe foo "bar baz" 123
"app.exe" foo "bar baz" 123
--
:wq
Mike Sanders
[toc] | [prev] | [next] | [standalone]
| From | Lawrence D’Oliveiro <ldo@nz.invalid> |
|---|---|
| Date | 2025-12-31 09:37 +0000 |
| Message-ID | <10j2qs4$2fbu5$1@dont-email.me> |
| In reply to | #396022 |
On Wed, 31 Dec 2025 03:28:03 -0000 (UTC), Michael Sanders wrote: > On Wed, 31 Dec 2025 03:10:52 -0000 (UTC), Lawrence D’Oliveiro wrote: > >> Clearly on Windows, there are no guarantees about argc contains, so >> you shouldn’t be relying on it. > > Some windows snippets: Are there any standards for how C argc/argv are supposed to behave on Windows?
[toc] | [prev] | [next] | [standalone]
| From | Michael Sanders <porkchop@invalid.foo> |
|---|---|
| Date | 2026-01-01 07:32 +0000 |
| Message-ID | <10j57ui$3aao2$2@dont-email.me> |
| In reply to | #396026 |
On Wed, 31 Dec 2025 09:37:08 -0000 (UTC), Lawrence D’Oliveiro wrote:
> Are there any standards for how C argc/argv are supposed to behave on
> Windows?
Good question, some more ways to open things (that I know of),
see 2nd example for 'sort of' argc/argv...
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
int open_app(const wchar_t *exe_or_path) {
HINSTANCE r = ShellExecuteW(NULL, L"open", exe_or_path, NULL, NULL, SW_SHOWNORMAL);
return ((INT_PTR)r > 32) ? 0 : -1;
}
open_app(L"notepad.exe");
open_app(L"C:\\Windows\\System32\\calc.exe");
or...
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <wchar.h>
int launch_app(const wchar_t *cmdline) {
STARTUPINFOW si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof si);
ZeroMemory(&pi, sizeof pi);
si.cb = sizeof si;
/* CreateProcess *may modify the buffer */
wchar_t buf[1024];
wcsncpy(buf, cmdline, 1023);
buf[1023] = L'\0';
if (!CreateProcessW(
NULL, // application name (NULL = parse from cmdline)
buf, // command line (MUTABLE) <--
NULL, NULL, // process/thread security
FALSE, // inherit handles
0, // creation flags
NULL, // environment
NULL, // working directory
&si,
&pi))
return -1;
/* fire-and-forget */
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
return 0;
}
launch_app(L"notepad.exe C:\\temp\\notes.txt");
launch_app(L\"\"C:\\Program Files\\VideoLAN\\VLC\\vlc.exe\" --fullscreen video.mp4\");
--
:wq
Mike Sanders
[toc] | [prev] | [next] | [standalone]
Page 6 of 10 — ← Prev page 1 … 4 5 [6] 7 8 … 10 Next page →
Back to top | Article view | comp.lang.c
csiph-web