Thanks every body for replay<br> yah I have implement C program to write  integers to a (binary) file and also read a single value by each process. but the confusion for me is that how to read more than one integer values from file and store in array, because storing values in array we must allocate memory for the array of size file(values)/process. and I want read from a single file by multiple processes and store the values in arrays of each processes.<br>

Example of write to Binary file is.<br>#include &lt;stdio.h&gt;<br>#include &lt;mpi.h&gt;<br><br>void main(int argc, char *argv[])<br>{<br>  int comm_size,comm_rank;<br>  int size_int,amode;<br><br>  MPI_Datatype etype,filetype;<br>

  MPI_Info info;<br>  MPI_Status status;<br>  MPI_File fh;<br>  MPI_Offset disp;<br><br>  MPI_Init(&amp;argc, &amp;argv);<br>  MPI_Comm_rank(MPI_COMM_WORLD,&amp;comm_rank);<br>  MPI_Comm_size(MPI_COMM_WORLD,&amp;comm_size);<br>

<br>  fname=&quot;data.dat&quot;;<br>  drep=&quot;native&quot;;<br><br>  amode=(MPI_MODE_CREATE|MPI_MODE_WRONLY);<br>  size_int=sizeof(size_int);<br>  info=MPI_INFO_NULL;<br><br>  MPI_File_open(MPI_COMM_WORLD,&quot;data.dat&quot;,amode,info,&amp;fh);<br>

<br>  disp=comm_rank*size_int;<br>  etype=MPI_INTEGER;<br>  filetype=MPI_INTEGER;<br><br>    MPI_File_set_view(fh,disp,etype,filetype,&quot;native&quot;,info);<br><br>  MPI_File_write_at(fh,disp,&amp;comm_rank,1,MPI_INTEGER,&amp;status);<br>

<br>  printf(&quot;Hello from rank %d. I wrote: %d\n&quot;,comm_rank,comm_rank);<br><br>  MPI_File_close(&amp;fh);<br>  MPI_Finalize();<br>}<br><br>and Example to read values from the file<br><br>#include &lt;stdio.h&gt;<br>

#include &lt;mpi.h&gt;<br><br>void main(int argc, char *argv[])<br>{<br>  int comm_size,comm_rank;<br>  int size_int,amode,itest;<br><br>  MPI_Datatype etype,filetype;<br>  MPI_Info info;<br>  MPI_Status status;<br>  MPI_File fh;<br>

  MPI_Offset disp;<br><br>  MPI_Init(&amp;argc, &amp;argv);<br>  MPI_Comm_rank(MPI_COMM_WORLD,&amp;comm_rank);<br>  MPI_Comm_size(MPI_COMM_WORLD,&amp;comm_size);<br><br>  amode=(MPI_MODE_RDONLY);<br>  size_int=sizeof(size_int);<br>

  info=MPI_INFO_NULL;<br><br>  MPI_File_open(MPI_COMM_WORLD,&quot;data.dat&quot;,amode,info,&amp;fh);<br><br>  disp=comm_rank*size_int;<br>  etype=MPI_INTEGER;<br>  filetype=MPI_INTEGER;<br><br><br>  MPI_File_set_view(fh,disp,etype,filetype,&quot;native&quot;,info);<br>

<br>  MPI_File_read_at(fh,disp,&amp;itest,1,MPI_INTEGER,&amp;status);<br><br>  printf(&quot;Hello from rank %d. I wrote: %d.n&quot;,comm_rank,itest);<br><br>  MPI_File_close(&amp;fh);<br>  MPI_Finalize();<br>}<br><br><br>

<br>thanks for precious time. <br>