02-05-2009
This Insure program is expressly preventing you from using dup2 to redirect stderr. Perhaps it has its own methods of redirecting logfiles that you're supposed to use instead? Why it thinks memory is corrupted, I don't know, it may be unrelated to the redirection and provoked by code below it you didn't post.
10 More Discussions You Might Find Interesting
1. Programming
I'm having difficulty understanding the purposes of using dup/dup2 when involving forks.
for example, if we call fork() once, that is, we are creating a child process. In what cases would we need to use dup or dup2 to duplicate the file descriptors for standard output and standard error? What... (1 Reply)
Discussion started by: Yifan_Guo
1 Replies
2. Shell Programming and Scripting
Hi,
I have a shell scripting. This will take 7 digit number in each line and add 7 digit number with next subsequent lines ( normal addition ).
Eg:
0000001
0000220
0001235
0000022
0000023
...........
.........
........
Like this i am having around 1500000 records. After adding... (23 Replies)
Discussion started by: thambi
23 Replies
3. UNIX for Advanced & Expert Users
int redirect()
{
int fd,rc;
fd = open("sample.DAT",O_CREAT | O_RDWR , 00777 );
rc = dup2(fd , 1 ) ;
close (fd );
return 0;
}
I used the above to redirect all the cout statements to sample.DAT. process is redirecting the output and I had two questions
1. All stdout/cout statements... (2 Replies)
Discussion started by: satish@123
2 Replies
4. UNIX for Dummies Questions & Answers
In LINUX(CentOS, RedHat) is there a way to have the banner statement appear before the logon instead of after the logon? In UNIX and Windows the banner appears before a person actually logs on, what I'm seeing in LINUX is that it appears after the login(ftp, telnet, SSH).
Thanks (0 Replies)
Discussion started by: ejjones
0 Replies
5. Programming
Hi all,I'm reading <Advanced programming in the UNIX environment>,that book asked the reader to implement a function which has same functions with dup2 without calling fcntl.Could anyone give me a tip?Any help will be appreciated.:) (8 Replies)
Discussion started by: homeboy
8 Replies
6. Shell Programming and Scripting
Hello everyone, I'm in need of some assistance. I'm currently enrolled in an introductory UNIX shell programming course and, well halfway through the semester, we are receiving our first actual assignment. I've somewhat realized now that I've fallen behind, and I'm working to get caught up, but for... (1 Reply)
Discussion started by: MrMagoo22
1 Replies
7. UNIX for Advanced & Expert Users
is it possible to duplicate file descriptors(opened by a different process) with the help of dup or dup2. the two process do not share parent child relationship as well. (2 Replies)
Discussion started by: replytoshishir
2 Replies
8. Shell Programming and Scripting
Hi All,
I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command.
The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies
9. Shell Programming and Scripting
I want to execute metasploit by two pipes to communicate with it, but I have troubles with that communication. When I run my program, I get this error: "stty: standard input: Inappropriate ioctl for device" and I don't receive the metasploit promt.
just select an exploit.
This is my code:... (2 Replies)
Discussion started by: dano88
2 Replies
10. Programming
What this code should do is: there are parent.cpp and child.cpp. Parent will send whatever is in the buffer to child and child will send back whatever received to parent. I do not know what I am doing wrong. I am confused what is missing in the parent and what else I should include into the child.... (1 Reply)
Discussion started by: ramono
1 Replies
LEARN ABOUT DEBIAN
explain_dup2_or_die
explain_dup2_or_die(3) Library Functions Manual explain_dup2_or_die(3)
NAME
explain_dup2_or_die - duplicate a file descriptor and report errors
SYNOPSIS
#include <libexplain/dup2.h>
void explain_dup2_or_die(int oldfd, int newfd);
DESCRIPTION
The explain_dup2_or_die function is used to call the dup2(2) system call. On failure an explanation will be printed to stderr, obtained
from explain_dup2(3), and then the process terminates by calling exit(EXIT_FAILURE).
This function is intended to be used in a fashion similar to the following example:
explain_dup2_or_die(oldfd, newfd);
oldfd The oldfd, exactly as to be passed to the dup2(2) system call.
newfd The newfd, exactly as to be passed to the dup2(2) system call.
Returns:
This function only returns on success. On failure, prints an explanation and exits.
SEE ALSO
dup2(2) duplicate a file descriptor
explain_dup2(3)
explain dup2(2) errors
exit(2) terminate the calling process
COPYRIGHT
libexplain version 0.52
Copyright (C) 2008 Peter Miller
explain_dup2_or_die(3)