- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do have a unicode text file, written by VBScript on Windows with a leading BOM.
I do want to read this File line by line from FORTRAN.
The processing is done in C and C++ (line by line), but i would like to stick with FORTRAN I/O if that is possible.
Any ideas please?
I do want to read this File line by line from FORTRAN.
The processing is done in C and C++ (line by line), but i would like to stick with FORTRAN I/O if that is possible.
Any ideas please?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At this time, the only suggestion I have is to open the file with ACCESS='STREAM' and read it byte by byte, figuring out for yourself where the line separators are. Adding support for alternate encodings is on our wish list, but is not something we expect to offer soon.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Module IFNLS contains routines for converting strings to and from Unicode. For a list, see the compiler documentation under Language Reference > A to Z Reference > Language Summary Tables > National Language Support Library Routines. You can read the lines as a string using A format and then convert as needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Steve,
but the problem is not the conversion, but the reading.
The file is split into records with cr lf, each as a wide character, meaning 0d00 0a00 in Hex.
The standard FORTRAN open has a RECTYPE of STREAM_LF, so the first READ Statement gets the first record starting with a BOM and up to, not including the LF.
The second READ gets the 0 Byte form the LF first and reads up to, not including the LF.
Is there a better way to READ the lines, or is there a chance of getting something like the support in MS C++?
Lothar
but the problem is not the conversion, but the reading.
The file is split into records with cr lf, each as a wide character, meaning 0d00 0a00 in Hex.
The standard FORTRAN open has a RECTYPE of STREAM_LF, so the first READ Statement gets the first record starting with a BOM and up to, not including the LF.
The second READ gets the 0 Byte form the LF first and reads up to, not including the LF.
Is there a better way to READ the lines, or is there a chance of getting something like the support in MS C++?
Lothar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At this time, the only suggestion I have is to open the file with ACCESS='STREAM' and read it byte by byte, figuring out for yourself where the line separators are. Adding support for alternate encodings is on our wish list, but is not something we expect to offer soon.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page