linux redirect problem



Hi
here is my c file, compile in gcc 3.X in linux:

#include <stdio.h>

int main()
{
printf("Hello\n");
if (fork() == 0) printf("world! \n");
}


When i execute the a.out like this:
a.out > myFile.

Inside myFile:
Hello
Hello
world!

How come?
thanks
from Peter (cmk128@xxxxxxxxxxx)

.



Relevant Pages

  • Re: compiled hello world
    ... i'm running windows, otherwise i'd ... i want to see if i can execute it over a linux server. ... int main{ ...
    (comp.os.linux.misc)
  • Difference in the behaviour
    ... that behaves differently on solaris and Linux. ... Now when I execute this program on Linux it over writes ...
    (comp.unix.programmer)
  • Can not open url using fopen or file
    ... foreach ($myfile as $vals){ ... I got an error: failed to open stream: Permission denied. ... The above script works on my windows pc, but does not work on Linux ... (Fedora 5, php v5.1.2). ...
    (comp.lang.php)
  • Namespace clash for istream object :-(
    ... int myClass::myfn ... but reads the text file successfully on Solaris and HP-UX. ... The object myfile ...
    (comp.sys.hp.hpux)