[TriLUG] Random numbers, backticks, regex in C?

Brian McCullough bdmc at bdmcc-us.com
Tue Mar 13 11:52:28 EDT 2007


On Tue, Mar 13, 2007 at 11:37:50AM -0400, Steve Litt wrote:
> Hi all,

Greetings, Steve.


> How do I generate random numbers in C? Is there a library interface 
> to /dev/urandom? What library files and header files do I use?

Try the man pages for rand, random, srand and srandom.


> How do I do the equivalent of a Perl or Bash backtick operator in C? 

Here you get to look at either "system", or "fork" and "exec."  Things
get a bit tricky with fork and exec, but you get a LOT of control. You
might also look at pipes.  "man -k" is your friend.




> Thanks
> SteveT


Welcome into the world of Un*x high-level assembler!


Brian




More information about the TriLUG mailing list