MP6
Photomosaic
|
CS 225 Util Library. More...
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <iostream>
#include "util.h"
Functions | |
pid_t | util::internal::exec::exec_cmd (const char *cmd, const char *const *args, int redirect_fd, int outpipe_fd=-1) |
Forks and executes the given command in child process, then returns child process pid. More... | |
ssize_t | util::writeBytesToFile (signed int fileDescriptor, const char *buffer, unsigned int bufferLength) |
A wrapper function which writes a buffer to a file. More... | |
CS 225 Util Library.
pid_t util::internal::exec::exec_cmd | ( | const char * | cmd, |
const char *const * | args, | ||
int | redirect_fd, | ||
int | outpipe_fd = -1 |
||
) |
Forks and executes the given command in child process, then returns child process pid.
Use exec_status() to wait and retrieve child return status.
heavily refactored, but originally from: http://stackoverflow.com/questions/2180079/how-can-i-copy-a-file-on-unix-using-c
ssize_t util::writeBytesToFile | ( | signed int | fileDescriptor, |
const char * | buffer, | ||
unsigned int | bufferLength | ||
) |
A wrapper function which writes a buffer to a file.