Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29263 ディスカッション

FullPathQQ - case of drive letter

Michael8
ビギナー
761件の閲覧回数
Hello:

I am using FullPathQQ and am finding that sometimes it returns the drive letter in the path as lower-case and sometimes as upper-case. I assume it's not specified in the IVF "standards" for this function as to which way it should do it. But it must be deciding based on some criteria. Is it something in my environment perhaps?

This is important because I have a program that I use for validation and I need to know when the output of the program changes. So my validation script does a "diff" on the output file (with the previous version of the file) to see if anything changed. Unfortunately it's flagging a bunch of lines as having changed when really it's just the drive letter that has a mismatched case. I realize that I could supply an option to the diff command to have it ignore case, but, for most of the output file, I would like it to be case-sensitive.

Thanks.
Michael
0 件の賞賛
4 返答(返信)
Martyn_C_Intel
従業員
761件の閲覧回数
Hello Michael,
I'm told that FULLPATHQQis expected toreturn an upper case drive letter, (returned from a Windows API call), unless you yourself pass it a full path name that includes a lower case drive letter. For example, assuming that the path is F:\Work, calling FULLPATHQQ with:

test13.cmd returns F:\Work\test13.cmd

f:\SomeOtherDir\test13.cmd returns f:\SomeOtherDir\test13.cmd

SomeOtherDir\test13.cmd returns F:\WORK\SomeOtherDir\test13.cmd

Apart from explicit coding of the drive letter, another way that variations could occur would be if you use a utility to get a path name which is thenused as input to FULLPATHQQ.For example, autility that searches your PATH might pick up an upper or lower case drive letter, depending on how you set up your PATH environment variable.

Please let us know whether this explains what you see.
If you have an example of code that returns a lower case drive letter, without being fed one as input, we'd like to see it, along with details of the environment, so that we can investigate.
Michael8
ビギナー
761件の閲覧回数
Hello:

Thank you for your reply. Indeed, when I run the program from the Visual Studio interface (via Start Without Debugging), it does seem to choose upper case.

I have figured out, however, that when running from a command line, it uses the case of the drive as it is stored "internally" in the command prompt. For example, if my current working directory in the command prompt is showing as F:\SomeDir, then it returns an upper-case "F" as the drive letter. But if my current working directory is showing as f:\SomeDir, then it returns a lower-case "f".

Once I'm ina command promt, I'm not sure how to get it to "internally" switch from upper to lower case (or vice versa), but I found I was able to control the case by using the "Start in" property in the shortcut I use to start the command prompt.

Thanks.
Michael
Martyn_C_Intel
従業員
761件の閲覧回数
The command promptdefaults to $P$G where $P is your current path. I'm not sure where that is taken from - it might be HOMEPATH, if you don't specify "startin". Anyway, glad that you found a solution.
John4
高評価コントリビューター I
761件の閲覧回数

Or you could just ensure that the drive letter is always in the intended case, for example:

!--------------------------------------------------------------------------------------------------
path = ADJUSTL(path)
N = INDEX(path, ':') - 1

do i = 1, N
idx = IACHAR(path(i:i))
if (97 <= idx .AND. idx <= 122) path(i:i) = ACHAR(idx - 32)
enddo
!--------------------------------------------------------------------------------------------------

返信