Home > Archive > Fortran > January 2006 > Differences between text file formats in Fortran and C?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Differences between text file formats in Fortran and C?
|
|
| ferrad 2006-01-20, 7:09 pm |
| 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
| |
| Colin Watters 2006-01-20, 7:09 pm |
| 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
>
| |
| ferrad 2006-01-20, 7:09 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.
| |
| ferrad 2006-01-20, 7:09 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
| |
|
|
"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
|
|
|
|
|