<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Sascha:</div><div class="gmail_quote">I'll replace *.txt file with a C-array to simply ex56.c. </div><div class="gmail_quote">Please ignore my previous request.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Hong</div><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hong,<br>
I do not have an immediate explanation for this. In particular, I wonder why<br>
there is no line break after 'sp=/' in this line:<br>
> file = 0x0, sp=/,fname=/Users/Hong/soft/petsc/<br>
but line breaks in the file path.<br>
<br>
On my machine I tested with make runex56, too. I will look at this again tomorrow.<br>
Can anyone else confirm this issue?<br>
<span class="HOEnZb"><font color="#888888"><br>
Sascha<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On 10 Mar 2015, at 22:22, Hong <<a href="mailto:hzhang@mcs.anl.gov">hzhang@mcs.anl.gov</a>> wrote:<br>
<br>
> Sascha:<br>
> I prepared a patch regarding the reading of the data file in ksp tutorial ex56.<br>
> It sets the path to the data file required for running the example relative to PETSC_DIR<br>
> instead of relative to the tutorials folder to allow running the example from any folder.<br>
><br>
> Also, I used PETSC_DIR_SEPARATOR instead of the currently hard coded ‘/‘<br>
> so that the code would also run on a windows machine … if anyone cared.<br>
> This fails on my MacPro by running 'make runex56':<br>
><br>
> file = 0x0, sp=/,fname=/Users/Hong/soft/petsc/<br>
> src/<br>
> ksp/<br>
> ksp/<br>
> examples/<br>
> tutorials/<br>
> data/<br>
> elem_3d_elast_v_25.txt<br>
>         main failed to open input file '/Users/Hong/soft/petsc/<br>
><br>
> I added<br>
> file = fopen(fname, "r");<br>
>       printf("file = %p, sp=%s,fname=%s\n",file,sp,fname);<br>
>       if (file == 0) {<br>
><br>
> as you see, 'sp=/' is followed by a 'new line'.<br>
> I do not see this behavior on other machines, e.g., linux or an old iMac.<br>
> Any suggestion?<br>
><br>
> Hong<br>
><br>
><br>
> Please discard the patch if you do not want to change the current behavior.<br>
><br>
> Best,<br>
> Sascha<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div></div>