11-30-2001
Simple Programming
I am writing a simple shell program using the
if
then
else
How do I use input in the program without using read?
10 More Discussions You Might Find Interesting
1. Programming
i would like advice on the usbject of c programming (in the middle of reading a book on C). could i benefit more if i apply that knowledge in the unix format if i were able to, or would that take the point out of learning C, basically I want to stay away from strying too far away from unix and use... (1 Reply)
Discussion started by: moxxx68
1 Replies
2. UNIX for Dummies Questions & Answers
Ok what is BSD exactly? I know its a type of open source but what is it exactly? (1 Reply)
Discussion started by: Corrail
1 Replies
3. Shell Programming and Scripting
hey all, im new and my first question is:
say i have a word "blahblah"
how do i get and replace the last letter of the word with say k, so replace the h with a k.
However you cant just replace the h it has to change the LAST LETTER of the word.
Cheers In advance.
:b: (0 Replies)
Discussion started by: aleks001
0 Replies
4. Programming
Hi all,
I am a newbie to unix programming using C..
So i would like to have a few simple C programs to start off with..
I wanted programs on learning ,
abort,kill and raise,alarm and pause,I would also like to know how to use the vfork() in a prg
It would be really great if i can have... (1 Reply)
Discussion started by: wrapster
1 Replies
5. Shell Programming and Scripting
hi
i want to write simple socket program which will listen on socket . here is the code
## read msg on socket
#! /usr/bin/perl
use IO::Socket::INET;
my $MySocket= IO::Socket::INET->new(LocalPort=>1234,
Proto=>'udp') ;
while ()... (2 Replies)
Discussion started by: zedex
2 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies
7. Programming
Can someone help me on suggesting some ways to access the memory content in RAM directly from C/C++ source code.
Please provide me any book name or any URL so that I can get an exhaustive
knowledge over it.
If possible please give me some tips on interacting with hardwares directly
through... (3 Replies)
Discussion started by: nandumishra
3 Replies
8. Shell Programming and Scripting
Hello all!
This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician.
Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix:
... (16 Replies)
Discussion started by: torchij
16 Replies
9. UNIX for Dummies Questions & Answers
Hello.
I like Linux and C programming language. Allways wanted to understand kernel and become a Linux system programmer. And I also like Objective-C and iOS. These two programming areas have relations:
1. Linux and iOS are UNIX-like systems, POSIX compliant.
2. It is useful to know C language... (2 Replies)
Discussion started by: Rockatansky
2 Replies
10. Red Hat
Cheers!
In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not?
To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies
popen(3) Library Functions Manual popen(3)
NAME
popen - Initiates a pipe to a process
LIBRARY
Standard C Library (libc.so, libc.a)
SYNOPSIS
#include <stdio.h>
FILE *popen (
const char *command,
const char *type );
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
popen(): XPG4, XPG4-UNIX
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Points to a null-terminated string containing a shell command line. Points to a null-terminated string containing an I/O mode.
DESCRIPTION
The popen() function creates a pipe between the calling program and a shell command to be executed. It returns a pointer to a FILE struc-
ture for the stream.
If the type parameter is the value r, the calling program can read from the standard output of the command by reading from the returned
file stream. If the type parameter is the value w, the calling program can write to the standard input of the command by writing to the
returned file stream.
Because open files are shared, a type r command can be used as an input filter and a type w command as an output filter.
NOTES
Programs using the popen() function to invoke an output filter should beware of possible deadlock caused by output data remaining in the
program's buffer. This can be avoided by either using the setbuf() function to ensure that the output stream is unbuffered, or by using
the fflush() function to ensure that all buffered data is flushed before calling the pclose() function. If the original processes and the
process started with the popen() function concurrently read or write a common file, neither should use buffered I/O. If they do, the
results are unpredictable.
RETURN VALUES
Upon successful completion, the popen() function returns a pointer to the FILE structure for the opened stream. In case of error because
files or processes could not be created, the popen() function returns a null pointer.
RELATED INFORMATION
Functions: exec(2), fork(2), fclose(3), fopen(3), pclose(3), pipe(2), setbuf(3)
Standards: standards(5) delim off
popen(3)