|
Posted by Keith Thompson on 08/15/06 04:49
"Chung Leong" <chernyshevsky@hotmail.com> writes:
> David T. Ashley wrote:
>> On a Linux platform, I have the need to call a compiled 'C' program from a
>> PHP script (to do some special authentication), and to keep the information
>> passed from the PHP script to the compiled 'C' program secret, i.e. the
>> information should not be passed on the command-line.
>>
>> The PHP pipe manipulation functions (such as popen) were suggested to me.
>>
>> Where can I find out more about pipes, specifically:
>>
>> a)How to use the C library calls to manipulate pipes?
The standard C library does not include support for pipes (unless you
count the handling of stdin and stdout, but that requires some
external process to set up the pipe).
There are functions under Unix-like systems, including Linux, for
creating and manipulating pipes, but questions about them are
off-topic in comp.lang.c.
> Google "stdio.h". To read from stdin, you just do it as though you're
> reading from the keyboard, with functions like gets() and getc(). To
> write to stdout, you use puts() or printf().
Never use gets(). It makes it practically impossible to avoid buffer
overflows. fgets() is a safe alternative.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
[Back to original message]
|