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

Craig Taylor ctalkobt at gmail.com
Tue Mar 13 11:45:34 EDT 2007


rand() and popen() are the function calls you're looking for.

Also, man 5(?) regexp should get you the regex library.  It's a bit
confusing at first but searching for regexp and example on google
should clear it up.

- Craig Taylor

On 3/13/07, Steve Litt <slitt at troubleshooters.com> wrote:
> 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/
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>



More information about the TriLUG mailing list