- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an application in fortran that writes some data into a file which is read by other applications running on platforms like Linux.
My problem is, when I write the content from the application compiled with Intel fortran on Windows, it puts an extra carriage return (a.k.a contro-M) at the end of each line and my Linux applications that read this file get tripped at this point as these don't expect a carriage return at the end of the line. My application is a combination of C and Fortran code and I have tried linking with binmode.obj of MSVC but it did not efffect the behavior at all.
I am giving a sample program here that can reproduce this behavior. Please let me know what I can do at the compiler level or in my program to avoid these carriage returns. Please suggest a simple change as these OPEN calls are spread all over my fortran application and I can't afford to change every such call.
PROGRAM FOPENTEST
open(unit=10, file='test.txt', status='new')
write(10, *) "This is a test message"
write(10, *) "This is the second message"
close(unit=10)
END
I know dos2unix can solve my problem but I would like a better way to deal with it.
I am currently using v7.1 compiler and setting RECORDTYPE = 'STREAM' seems to have no effect on these line endings. I use formatted sequential files so /fpscomp does't seem to have a solution to my problem too.
I realize that setting RECORDTYPE to 'STREAM' works in v8.1 and above but I was wondering if there is a standard way to handle this in v7.1 without having to upgrade.
I see that Absoft fortran has a compiler option -unixeol to handle something like this.
Any help in this regard would be highly appreciated.
Thanks,
Subhash
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply. I guess I have no choice but to upgrade now.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page