fopen always returns fid=-1 since revision 8380

Thomas Treichl Thomas.Treichl at gmx.net
Mon Dec 8 04:22:55 CST 2008


Thomas Treichl schrieb:
> Hi,
> 
> with revision 8380, "allow initialized local buffers", there came a 
> strange problem with it. I don't see this problem with revision 8379. 
> Because this changeset is very small I hope somebody can tell me what is 
> going on.
> 
> If I do
> 
>   fid = fopen ("file.txt", "w")
> 
> then I always get a fid=-1 if the file is not there and must be created. 
> If the file is already there then it can be opened correctly for 
> overwriting and I get a valid fid.
> 
> I noticed that problem because the number of failures while doing "make 
> check" increased rapidly from revision 8379 to 8380, for example
> 
>   >>>>> processing 
> /Users/Thomas/Development/octave/src/DLD-FUNCTIONS/dlmread.cc
>   ***** shared file
>   file = tmpnam ();
>   fid = fopen (file, "wt");
>   fwrite (fid, "1, 2, 3\n4, 5, 6\n7, 8, 9\n10, 11, 12");
>   fclose (fid);
>   !!!!! test failed
>   fwrite: invalid stream number = -1shared variables {
>     file = [](0x0)
>   }
> 
> dlmread.cc on its own produces 20 failures on my Mac. Which line of 
> changeset 8380 could make that problems?

If I knew that my first trial would already succeed then I just would have sent 
the solution how it can be solved ;) It seems that I'm the lucky one who has a 
compiler that doesn't like OCTAVE_LOCAL_BUFFER always. A changeset for that line 
that is causing the problem is attached (which is just a copy and paste from the 
old lines that were there in revision 8379).

Regards,

   Thomas
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: OCTAVE_LOCAL_BUFFER.changeset
Url: https://www-old.cae.wisc.edu/pipermail/octave-maintainers/attachments/20081208/2b588c13/attachment-0001.ksh 


More information about the Octave-maintainers mailing list