I'm trying to write a parallel IO program with MPI, I'm required to write the data to the file with a format as: 02 03 04 in the file instead of 2 3 4.
fprintf(fpOut,"%.2d ",var);
Would be the serial counterpart of what I'm trying to do. I've looked around but couldn't find any answers so far. Any idea on how I might go about this?
MPI_IOwrites binary data (vs text/formatted data).So if you really want to write in parallel, you can use an intermediate buffer, and then write it, for example
That being said, you might want to reconsider your workflow: