¡@

Home 

c++ Programming Glossary: dup2

Writing my own shell… stuck on pipes?

http://stackoverflow.com/questions/1461331/writing-my-own-shell-stuck-on-pipes

into the other. I think I just don't understand how to use dup2 and pipes properly. I've now included my code which is still.. exit 1 child process if PID 0 else if pid 0 if hasPrevCmd dup2 fd 0 0 close fd 0 close fd 1 if hasNextCmd dup2 fd 1 1 close.. hasPrevCmd dup2 fd 0 0 close fd 0 close fd 1 if hasNextCmd dup2 fd 1 1 close fd 0 close fd 1 execvp arrayOfWords 0 arrayOfWords..

Is there a replacement for unistd.h for Windows (Visual C)?

http://stackoverflow.com/questions/341817/is-there-a-replacement-for-unistd-h-for-windows-visual-c

F_OK 0 Test for existence. #define access _access #define dup2 _dup2 #define execve _execve #define ftruncate _chsize #define.. 0 Test for existence. #define access _access #define dup2 _dup2 #define execve _execve #define ftruncate _chsize #define unlink..

C++: Redirecting STDOUT

http://stackoverflow.com/questions/4810516/c-redirecting-stdout

setbuf thing works fine. I ended up doing the fancier dup dup2 thing redirecting to a pipe. Update I wrote a blog post showing.. to a pipe. Update I wrote a blog post showing the dup2 method I ended up using which you can read here . It's written..

C/C++ with GCC: Statically add resource files to executable/library

http://stackoverflow.com/questions/4864866/c-c-with-gcc-statically-add-resource-files-to-executable-library

How to redirect qDebug, qWarning, qCritical etc output?

http://stackoverflow.com/questions/4954140/how-to-redirect-qdebug-qwarning-qcritical-etc-output

resorting to shell scripts I'm guessing that open and dup2 will do the job in Linux but will it work compiled with MinGW..

Redirect FROM stderr to another file descriptor

http://stackoverflow.com/questions/5095839/redirect-from-stderr-to-another-file-descriptor

is my first attempt bool redirect_stderr int fd return dup2 2 fd 0 Here fd was successfully obtained from open foo bar O_APPEND.. S_IRUSR S_IWUSR if fd 0 throw RUNTIME_ERROR else if 1 dup2 fd STDERR_FILENO throw RUNTIME_ERROR std cout std cerr Fine.. correctly created if it doesn't exist. c unix pipe stderr dup2 share improve this question You reversed the arguments it's..

Windows C++: How can I redirect stderr for calls to fprintf?

http://stackoverflow.com/questions/7664/windows-c-how-can-i-redirect-stderr-for-calls-to-fprintf

one end of the socket is where I send stderr via a call to dup2 and the other end is monitored in a thread where I can then..

Speeding up file I/O: mmap() vs. read()

http://stackoverflow.com/questions/8056984/speeding-up-file-i-o-mmap-vs-read

and the pipe as stdout. if pid fork waitpid pid ... else dup2 dest 1 dup2 source 0 execlp cat cat Update0 If your processing.. as stdout. if pid fork waitpid pid ... else dup2 dest 1 dup2 source 0 execlp cat cat Update0 If your processing is file agnostic..

Linux 3.0: Executing child process with piped stdin/stdout

http://stackoverflow.com/questions/9405985/linux-3-0-executing-child-process-with-piped-stdin-stdout

is that I only redirect the I O in the child note the dup2 calls are only in the child path. This is very important because.. fork if 0 nChild child continues here redirect stdin if dup2 aStdinPipe PIPE_READ STDIN_FILENO 1 perror redirecting stdin.. 1 perror redirecting stdin return 1 redirect stdout if dup2 aStdoutPipe PIPE_WRITE STDOUT_FILENO 1 perror redirecting stdout..