Re: Read DOS or Unix files with the same fortran code
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Wed, 28 Nov 2007 07:58:39 -0800
tianyf@xxxxxxxxx <tianyf@xxxxxxxxx> wrote:
I used Fortran to read/write ASCII files in FreeBSD, Solaris, and
Windows. There seems no problems. I suppose that the line-ending
difference between DOS and Unix sytles does not matter.
Then your experience is limitted. This kind of thing depends on the
particular compiler and its run-time libraries. I assure you that there
have existed compilers on those systems for which is *DOES* matter.
In fact, I'm somewhat surprised at the comment because in my experience
it very often matters. We have certainly helped many people in this
newsgroup who had problems with this.
In particular, although some (but not all) DOS compilers can handle the
Unix line endings, my experience is that very few Unix-based compilers
directly handle DOS line endings. The problem there is that a DOS text
file is also a valid Unix text file, but with a different
interpretation. On Unix, the CR character counts as part of the data
instead of part of the line terminator. If a Unix compiler handled DOS
text files, then that would mean there were legitimate Unix text files
that it could not handle correctly. Of course, there could be some kind
of selectable option, but it is hard to imagine how this could be made
to "just work" without user intervantion of some sort.
Depending on how you read the files, you might not notice the problem.
For example, if you always read fixed-length fields, then extra "junk"
at the end of each record might not matter.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.
- Follow-Ups:
- Re: Read DOS or Unix files with the same fortran code
- From: tianyf@xxxxxxxxx
- Re: Read DOS or Unix files with the same fortran code
- References:
- Read DOS or Unix files with the same fortran code
- From: feenberg
- Re: Read DOS or Unix files with the same fortran code
- From: tianyf@xxxxxxxxx
- Read DOS or Unix files with the same fortran code
- Prev by Date: Re: Pointers and DLLs/shared libraries
- Next by Date: Re: is this newsgroup accessible via gmane
- Previous by thread: Re: Read DOS or Unix files with the same fortran code
- Next by thread: Re: Read DOS or Unix files with the same fortran code
- Index(es):
Relevant Pages
|