Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Using GETARG with Drag and Drop

jcbreeding
Beginner
571 Views
I would like to write a QuickWin program that I can drag and drop an input file onto the executable to open and run the file. I tried using GETARG to get the directory and file name so the program could read the input file. GETARG couldn't read the pathname correctly.

Example:
Real pathname -> C:PROGRAM FILESMICROSOFT VISUAL STUDIOCommonMDSEV98MYPROJECTSMISCSOURCE web.f

What GETARG reads -> C:PROGRA~1MICROS~2CommonMSDEV98MYPROJ~1MISCSO~1 web.f

Is there some other way to get the correct pathname? Am I doing something wrong?

Jim Breeding
0 Kudos
5 Replies
Steven_L_Intel1
Employee
571 Views
That is correct - that's how Windows mangles long file names when it thinks that applications may not understand them. GETARG is just returning what Windows supplied.

Steve
0 Kudos
isn-removed200637
571 Views
Have you tried actually opening the file with the 'mangled' path?
I think Windows should still recognise it.
If you look in the registry, you come across many similar mangled paths with ~1, ~2 in them, and Windows still 'knows' what they 'really' are, otherwise the registry entries are useless.
What version of Windows are you using?

I have used GETARG in this way on '98, NT and 2000
and had no problems except those caused by me.

0 Kudos
isn-removed200637
571 Views
Umm.. I think your problem may be because of the way you
have your disk formatted (to find out, open Explorer and right-click on the disk icon and select Properties). Mine was changed from FAT to NTFS some time back. I think FAT has the problems with long filenames. You may find the problem disappears when you convert to NTFS (See Windows Help for instructions etc.). You will also save space on your disk. HTH
0 Kudos
jcbreeding
Beginner
571 Views
I can open the file with the mangled pathname. I just panicked when I saw the output from a test program that simply wrote out the pathname. When I added file read logic it work fine. Microsoft!!??
0 Kudos
isn-removed200637
571 Views
You may find that if the path and filename have been mangled twice (i.e. ~1 and ~2 appear in the same file-path-name), then Windows may fail to resolve it correctly. I recall this happening to me in the past.
good luck.
0 Kudos
Reply