Differences between text file formats in Fortran and C?

  • Follow


I have a bit of Fortran code which opens a text file, writes to it, and
closes it.  It then calls a C DLL which opens the file for appending.
This open fails with:

ERROR_ALREADY_EXISTS
  // The system cannot create a file when it already exists.

It works fine on the C side if the Fortran code does not create this
file first.

Is there an incompatibility of text file formats between C and Fortran?
 Can I get around it?

Adrian

0
Reply acfer (43) 1/20/2006 9:23:33 PM

Actually I think the Fortran connection above is a red herring, as the
append mode of the fopen function in C does not appear to work.  So
it's probably a C problem.

0
Reply acfer (43) 1/20/2006 9:45:52 PM


MS VS.NET / Intel v9.0.028
Actually I posted more on this on comp.lang.c earlier today, before I
looked at the Fortran connection (take a look there for code, etc).
And now I don't think it's Fortran related at all (see later post
here).  There appears to be some problem with the append feature of
fopen.

Adrian

0
Reply acfer (43) 1/20/2006 9:48:58 PM

"ferrad" <acfer@hotmail.com> wrote in message 
news:1137792213.663491.226960@o13g2000cwo.googlegroups.com...
>I have a bit of Fortran code which opens a text file, writes to it, and
> closes it.  It then calls a C DLL which opens the file for appending.
> This open fails with:
>
> ERROR_ALREADY_EXISTS
>  // The system cannot create a file when it already exists.
>
> It works fine on the C side if the Fortran code does not create this
> file first.
>
> Is there an incompatibility of text file formats between C and Fortran?
> Can I get around it?
>
> Adrian
>
If I understand you correctly, your C code opens the file after the Fortran 
code has closed it.    It certainly seems like the error message was 
generated by the C code.  Certainly C should never complain about not being 
able to create a file since, if you input the correct code in the C open 
routine (whichever one you chose), then the issure of creating an existing 
file should never arise.
Jim 


0
Reply j.n (116) 1/21/2006 2:50:42 AM

Platform? Compilers? assume Windows 2000, Intel 9.x, Intel ...

--
Qolin

Email: my qname at domain
Domain: qomputing dot demon dot co dot uk
"ferrad" <acfer@hotmail.com> wrote in message
news:1137792213.663491.226960@o13g2000cwo.googlegroups.com...
> I have a bit of Fortran code which opens a text file, writes to it, and
> closes it.  It then calls a C DLL which opens the file for appending.
> This open fails with:
>
> ERROR_ALREADY_EXISTS
>   // The system cannot create a file when it already exists.
>
> It works fine on the C side if the Fortran code does not create this
> file first.
>
> Is there an incompatibility of text file formats between C and Fortran?
>  Can I get around it?
>
> Adrian
>


0
Reply qolin.SEE_SIGNATURE (154) 1/21/2006 9:40:11 PM

4 Replies
46 Views

(page loaded in 0.142 seconds)

Similiar Articles:













7/16/2012 12:15:37 AM


Reply: