Sending email using a command like mailx or sendmail requires a fork/exec on the child
side then wait on the parent side. This is exactly what the system() call does.
The alternative is to do what sendmail does in C code. system("/usr/bin/sendmail ... ") being infinitely simpler. IF you're sending 100K mail messages per day you should incorporate sendmail code, otherwise for a few dozen messages per day, consider system().
Start here to see what sendmail does, it is open source.
I have my inputfile in the following format :
From:sdhfhg
dsfhsdjfjdsfh
dsfjdjshjsd
djfhsdjfjsdhjds
Error Description
<aa.aa.aa.aa.aa.aa>
From:ksljfsdhfjh
djfdsjkf
sdjwoquk
dsfsdfj
Error Description
<dd.dd.dd.dd.dd>
I want to read the lines from tag 'From:' thrul <aa.aa.aa.aa.aa.aa>... (1 Reply)
Hello experts,
I am using fork() in my code but I am confused which output comes first child or parent?
I did the following code .My book shows parent first but my linux shows child first.Can anyone tell me why?
#include <stdio.h>
int main(){
int pid;
printf("I am original process with pid... (5 Replies)
Assume we have an application built on *nix that uses fork()...then the processes procedure is going to act as follow:
X is considered a parent process (first click on application)
Y is considered a child process of X (second click on application)
Z is considered a child process of Y (third... (6 Replies)
hi,
i start using awk and have a very basic problem. here's my code:
#! /usr/bin/awk -f
# 2010, scz
#
{
$1 == "test" { print $2 }
}
this works on the command line but not as "program" - what is the difference between awk programs on the command line and executing awk... (3 Replies)
I writing a program that forks three times but only on the parent process. The three children processes then produces output in order. 1, 2, 3. I am confused on how to do this. I have tried multiple if and else if statements but the output does not come out right. How should I go about doing this? (1 Reply)
Hello everybody.I want to make clear that i am not going to ask from anybody to build my asignement but i have a big problem. I can't seem to find anywhere ONE good example on C about what i am trying to do:wall:.I think it is simple. All i ask is one example, even a link is fine.
So, i want to... (1 Reply)
i'm experimenting fork function and i found this code
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <wait.h>
#include <fcntl.h>
#include <unistd.h>
int main(void)
{
int fd;
pid_t p;
p = fork();
fork();
if (p>0) { fork();}
fork();
fork();... (6 Replies)
Hi All,
I have a program for class that needs to do the following:
1. Print the directory entries from the current directory using ncurses
2. Provide a prompt next to each directory entry and allow the user to enter commands that may or may not be about the file
3. Execute those commands in... (1 Reply)
Hello... And thanks in advance for any help anyone can offer me on my question! I've been doing a lot of reading to try and find my answer... But I haven't had any luck
What I'm trying to understand is where a child process inherits global environment variables from? I understand the exec()... (2 Replies)
Discussion started by: bodisha
2 Replies
LEARN ABOUT MOJAVE
dlclose
DLCLOSE(3) BSD Library Functions Manual DLCLOSE(3)NAME
dlclose -- close a dynamic library or bundle
SYNOPSIS
#include <dlfcn.h>
int
dlclose(void* handle);
DESCRIPTION
dlclose() releases a reference to the dynamic library or bundle referenced by handle. If the reference count drops to 0, the bundle is
removed from the address space, and handle is rendered invalid. Just before removing a dynamic library or bundle in this way, any termina-
tion routines in it are called. handle is the value returned by a previous call to dlopen.
Prior to Mac OS X 10.5, only bundles could be unloaded. Starting in Mac OS X 10.5, dynamic libraries may also be unloaded. There are a cou-
ple of cases in which a dynamic library will never be unloaded: 1) the main executable links against it, 2) An API that does not supoort
unloading (e.g. NSAddImage()) was used to load it or some other dynnamic library that depends on it, 3) the dynamic library is in dyld's
shared cache.
RETURN VALUES
If dlclose() is successful, it returns a value of 0. Otherwise it returns -1, and sets an error string that can be retrived with dlerror().
SEE ALSO dlopen(3)dlsym(3)dlerror(3)dyld(3)ld(1)cc(1)
Nov 6, 2006