Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Feb 1999 03:31:49 +0900
From:      "Masahiro Ariga" <mariga@cd.mbn.or.jp>
To:        <freebsd-questions@FreeBSD.ORG>
Subject:   Is my BSD wrong installed?
Message-ID:  <000601be52c8$2b4f32a0$064ca8c0@gateway>

next in thread | raw e-mail | index | archive | help
My name is Masahiro Ariga.
I had a spare PC,so I installed Free BSD on it and began studying UNIX
programing.Although I made some C programs on Windows environment,I am
completely at lost in UNIX programing so I bought UNIX program book and made
sample run on my BSD machine.
But its output never become the same as the book's answer.I cannot tell it
is because of my BSD machine being wrongly installed,or it is because
"That's UNIX."
Please teach me.
Sample is as follows,
[Sample program]
#include <stdio.h>

main()
{
    if(fork()==0)
        printf("I am son!\n");
    else
        printf("I am father!\n");
}

And,Book says it's output should be,
% sample
I am son!
I am father!
% ■           ----■ is cursor mark.

But my machine's output is as follows,

% sample
I am father!
% I am son!
■

Here,two questions arise,
(1) why my output is father's line and son's line exchanged ?
(2)On second output,why % mark appears  first,and why not returns to normal
prompt.

I beseech senior UNIX programmers to teach me.
My mail address is
mariga@cd.mbn.or.jp
                                                    Sincerely yours,



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000601be52c8$2b4f32a0$064ca8c0>