10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have seen this code in a few places and my understanding is they are using it to determine what app called the script.
I have a script that is called by two different applications and what it to do one thing when called by one and something else when called by the other. How do I determine... (1 Reply)
Discussion started by: croyleje
1 Replies
2. 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
3. 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
4. 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
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. 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
7. Programming
Hi,
i have in one program such a pice of code
................
static int old_stderr_handle = -1;
static int old_stdout_handle = -1;
log_handle = open(log_file_name,O_CREAT|O_RDWR,932);
old_stderr_handle = dup(STDERR_FILENO);
if (dup2(log_handle,STDERR_FILENO) < 0)
{
//... (1 Reply)
Discussion started by: vovan
1 Replies
8. Programming
when i want to replace standard output with output file
int out;
out = open("out", O_WRONLY)p;
dup2(out,1);
What Shall I do in case of appending??? I am using here O_WRONLY TO WRITE.BUT IF i wanna append, whats the word? (5 Replies)
Discussion started by: joey
5 Replies
9. Programming
I have met this code:
switch(fork()) {
case 0:
close(1);
dup(p);
close(p);
close(p);
execvp(<whatever>);
perror("Exec failed");
}
Can anyone tell me what this piece of code does?
Thx alot.. (1 Reply)
Discussion started by: AkumaTay
1 Replies
10. Programming
Would anyone be so kind to explain to me the function of dup() in UNIX? As far as I am concerned, it duplicates a file descriptor. Under what circumstances would we need to duplicate a file descriptor in a UNIX environment?
Thank you.
vinchen (3 Replies)
Discussion started by: vinchen
3 Replies