Pass "-v" option to gcc and post its output, as in:
Code:gcc -v
Pass "-v" option to gcc and post its output, as in:
Code:gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)
I don't have gcc so I can't help you out further and the vendor-supplied compiler is giving me right results.
Could anyone tell me what the compiler is?
You can purchase it from SGI, though I am not sure if it will work for your Debian Linux release ie x86 architecture.
Check out their site for developers or give them a call for more information.
Whatever you do don't end up purchasing a compiler that is not written for your target architecture.
Alright one more thing about this code. I'm trying to get the parent to display the counts and the child to display its pid but when I editted it nothing shows on the screen.
Code:#include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(void) { pid_t childpid; int count[2]; int fd[2]; int m; pipe(fd); if ((childpid = fork()) == -1) { perror("fork"); exit(1); } else if (childpid == 0) { dup2(fd[0], 0); read(fd[0], count, sizeof count); printf("child process: this is my pid %d\n", getpid()); } else if (childpid > 0) { //close(fd[0]); dup2(fd[1], 1); for (m = 0; m < 10001; m++) { if ((m%5) == 0) count[0]++; if ((m%3) == 0) count[1]++; } printf("child process: no. of multiples of 5 are %d" " and those of 3 are %d . The Pid is %d\n", count[0], count[1], getpid()); write(fd[1], count, sizeof count); } return 0; }
Because output of the parent is going into the pipe to the child process, so it won't be displayed on the terminal. Perhaps all you need is stdin and stdout without pipes.
so you can communicate between processes using stdin and stdout?