Open unicode filename

Open unicode filename

Microsoft uses unicode filenames in NTFS.  http://msdn.microsoft.com/en-us/library/windows/desktop/dd317748%28v=vs....

My attempts to open a file with a unicode name have proven unsuccessful. I am passing the unicode in from C++, when the program comes to the open statement is fails with a file not found.  If I force the C++ to convert the filename to ANSI characters, it works.  With the Unicode name being passed, I have tried doubling the length of the string being passed to the Fotran from the C++.  The results show below are from this case.

        OPEN ( UNIT =  IOINP, FILE = INFILE, ACTION = 'READ',  FORM = 'FORMATTED', IOSTAT = IOS, ERR = 998 )

...

  998 CONTINUE

      WRITE (16, *) 'IOS = ', IOS, LEN ( INFILE ), INFILE

The output looks like

 IOS =           29          42 B a k k e n   H o r i z o n t a l . d a t

The intell help file states: "The name can be any pathname allowed by the operating system.  Any trailing blanks in the name are ignored."

My experience indicates that the Intel Fortran statement only accepts ANSI characters, Microsoft documentation states that MS uses Unicode file names.  In countries which use a unicode character set, how does one use the Intel Fortran OPEN statement?

Clayton Evans

publicaciones de 5 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

You are correct that the compiler does not support unicode. We do support multibyte characters though. You can use MBConvertUnicodeToMB to convert the unicode file name to multibyte.

So if one has a filename with Unicode characters, Intel Fortran cannot open the file.  Correct?

Correct, unless it is converted to multibyte.

You could also open the file using the USEROPEN extension and the underlying CreateFileW api.

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya