Newsgroups: comp.parallel.pvm
From: Chan Suet Mei <cssmchan@cs.cityu.edu.hk>
Subject: Messages from slaves?
Organization: City University of Hong Kong
Date: Thu, 08 Feb 1996 17:54:44 +0800
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <3119C864.167EB0E7@cs.cityu.edu.hk>

Hi there,

I have met a problem. I am now using SUN workstation, C and PVM 3.3.9 to write a
master and a slave program.

I put pvm_catch(stdout) before pvm_spawn and expect the printf message from the
slave can be shown on the master host.

In my slave program, I wrote :

main ()
{ ...
  ...
  printf("\nI am slave\n");
  fflush(stdout);
  module_read_file();
  pvm_exit();
  exit(0);
};

module_read_file()
{
  ...
  FILE *pfile;

  pfile=fopen("filename","r");
  printf("\nfile opened!\n");
  fflush(stdout);

  fscanf (pfile, ........);
  printf("\nafter first fscanf\n");
  fflush(stdout);

  fclose(pfile);
);

And the following is the result I got from the master side :
[t140018] BEGIN
[t140018]
[t140018] I am slave
[t140018]
[t140018] file opened!
[t140018] EOF

The message just after fopen() can be seen. But the message after fscanf()
is not shown.

I think there may be some confusions for the buffer handling for the stream "stdout"
and "pfile"...or is it caused by some other reasons? Can anyone give me a help
to solve this problem?

Thanks in advance. :)

Chan Suet Mei.
[E-mail]cssmchan@cs.cityu.edu.hk

