[mpich-discuss] scanf with MPICH2 for Win7
Alejandro Allievi
alejandro.allievi at gmail.com
Fri Mar 23 06:25:11 CDT 2012
Hi Rajeev,
It worked, thanks a lot!!
Would you have an idea of why I need to force the writing of buffered
data in the output stream in Win and not in UNIX??
Would fflush(NULL) be equivalent or preferable??
Thanks for your help again.
Alex
On Thu, Mar 22, 2012 at 11:35 PM, Rajeev Thakur <thakur at mcs.anl.gov> wrote:
> Try adding an fflush(stdout); after the printf.
>
> On Mar 22, 2012, at 4:25 PM, Alejandro Allievi wrote:
>
>> Hi,
>>
>> I'm running a Get-input(...) function that takes input from stdin with
>> the following code snippet
>> ......
>>
>> if (my_rank == 0) {
>> printf("Enter a, b, and n\n");
>> scanf("%lf %lf %d", a_p, b_p, n_p);
>> ...
>> }
>>
>> It compiles and runs giving the right result, no problem. HOWEVER, the
>> scanf seems to execute before the printf. In other words, when I run
>> the program I need to enter a, b and n and then "Enter a, b, and n"
>> appears on my screen, and the program runs correctly to completion. It
>> does not happen in UNIX, only happens in MPICH2 for Win7 64bit.
>>
>> Has anybody encountered this problem or has any hints on its cause???
>>
>> Thank you.
>>
>> Alex
>> _______________________________________________
>> mpich-discuss mailing list mpich-discuss at mcs.anl.gov
>> To manage subscription options or unsubscribe:
>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>
> _______________________________________________
> mpich-discuss mailing list mpich-discuss at mcs.anl.gov
> To manage subscription options or unsubscribe:
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
--
Dr Alejandro Allievi, PhD, PEng
"Tenez, mon ami, si vous y pensez bien, vous trouverez qu'en tout,
notre véritable sentiment n'est pas celui dans lequel nous n'avons
jamais vacillé; mais celui auquel nous sommes le plus habituellement
revenus". Denis Diderot.
This email and its attachments are for the sole use of the addressee
and may contain information which is confidential and/or legally
privileged. This email and its attachments are subject to copyright
and should not be partly or wholly reproduced without the consent of
the copyright owner. If you receive this email in error, please
immediately delete it from your system and notify the sender by return
email.
More information about the mpich-discuss
mailing list