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

Steve Litt slitt at troubleshooters.com
Tue Mar 13 11:37:50 EDT 2007


Hi all,

I've had 13 years paid experience in C, every one of them using DOS/Windows, 
PDP-11 or VAX. As a result, there are certain UNIX things I don't know how to 
do in C, and was wondering if any of you could enlighten me.

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?

How do I do the equivalent of a Perl or Bash backtick operator in C? I need to 
capture the stdout output of the called program. I could do it the way I did 
in DOS -- have the spawned program write to a file, and then read the file, 
but that kinda turns my stomach now that I use Linux. What library files and 
header files do I use?

Does the gcc bundled with Linux have libraries for Regex, and if so, where can 
I see an example?

Thanks

SteveT

Steve Litt
Author: Universal Troubleshooting Process books and courseware
http://www.troubleshooters.com/



More information about the TriLUG mailing list