cyberkazoo
Registered
Hi, all,
This questions is for programmers....
On one of the classes I'm taking, we're using ssh to the Linux (RedHat) servers. And the part of the assignments is to create apps on Linux.
I was first very excited because I thought I could take a full use of Unix part of OS X, but apperently, I'm discovering a lot of differences.
My assignment this time, is like this:
type ./prog3 X ...where prog3 is the app name, and X is variable.
This creates X number of child processes, and creates X number of files containing the summation of child ID. For example, if X=5, you'll see 5 files created; Child_1.txt with 1 written in it, Child_2.txt with 3 written in it (1+2), Child_3.txt with 6 written in it (1+2+3), Child_4.txt with 10 written in it (1+2+3+4), and Child_5.txt with 15 written in it (1+2+3+4+5). As files are being created, it displays what's in those files (when you're on the child process, if I'm not mistaken).
This C++ code works just fine when compiled and run on the Linux server, but not on the mac. I first noticed the fact Linux requires 5 more header files and they're not needed on mac (no difference and it compiles just fine without them and produces the same result).
I'm completely puzzled. Can somebody help me solve this?
I attached the source code so you can play with it. (This board doesn't allow me to post .cpp file, so the file extension is changed to .txt. Please change back to .cpp when you use this.)
Any input is greatly appreciated.
This questions is for programmers....
On one of the classes I'm taking, we're using ssh to the Linux (RedHat) servers. And the part of the assignments is to create apps on Linux.
I was first very excited because I thought I could take a full use of Unix part of OS X, but apperently, I'm discovering a lot of differences.
My assignment this time, is like this:
type ./prog3 X ...where prog3 is the app name, and X is variable.
This creates X number of child processes, and creates X number of files containing the summation of child ID. For example, if X=5, you'll see 5 files created; Child_1.txt with 1 written in it, Child_2.txt with 3 written in it (1+2), Child_3.txt with 6 written in it (1+2+3), Child_4.txt with 10 written in it (1+2+3+4), and Child_5.txt with 15 written in it (1+2+3+4+5). As files are being created, it displays what's in those files (when you're on the child process, if I'm not mistaken).
This C++ code works just fine when compiled and run on the Linux server, but not on the mac. I first noticed the fact Linux requires 5 more header files and they're not needed on mac (no difference and it compiles just fine without them and produces the same result).
I'm completely puzzled. Can somebody help me solve this?
I attached the source code so you can play with it. (This board doesn't allow me to post .cpp file, so the file extension is changed to .txt. Please change back to .cpp when you use this.)
Any input is greatly appreciated.