- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Everybody knows that short file names ( 8-dot-3 ) could be used instead of long file names
with a C/C++ compiler option '/I' or with '#include "..."' directives in a C source file.
Are there any hidden problems with short file names when used on a Windows platform with NTFS
file system? My answer is Yes.
I recently lost almost 2 hours when a project build failed and it was unclear why it happened.
When I finally understood what happened I reproduced a problem.
Let's say there is a C source file with a directive:
...
#include "../Test/ThisIs~1.abc" // Long name is 'ThisIsTest.abc'
...
Do the following steps in a folder 'Test':
Step 1: Create a file 'ThisIsTest.abc'
Step 2: Create a copy 'ThisIsTest.bak.abc' of the file 'ThisIsTest.abc'
Step 3: Rename the file 'ThisIsTest.abc' to 'ThisIsTest.old.abc'
Step 4: Rename the file 'ThisIsTest.bak.abc' to 'ThisIsTest.abc'
Step 5: Delete the file 'ThisIsTest.old.abc'
Result is as follows:
When a C/C++ compiler will try to compile the C source file with a directive
...
#include "../Test/ThisIs~1.abc" // Long name is 'ThisIsTest.abc'
...
it won't find 'ThisIs~1.abc' file because it no longer exists! Instead, there is afile 'ThisIs~2.abc'!
Please take a look at enclosed screenshot from a test computer:
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for sharing.
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A final shortname was:
'ThisIs~1.abc'
It meansthat NTFS and FAT32 are a little bit "incompatible" when a short file name is assignedto a file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
you are welcome
for shorting a long file name, long path tool is the best option, try it.
.................
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The short file name can be considered a hash code concatenated with ~SequenceNumber when the hash code cannot be unique.
Name collisions in the hash code are common. Upon collision, the SequenceNumber is generated such that it is unique for that particular hash code (in that specific directory). This means, depending on sequence of file creation, the ~SequenceNumber appendage may differ from time to time and/or from system to system as you have shown. It is the programmers responsibility to take this into consideration. This is not a fault of the file system.
*** This includes not assuming PROGRA~1 is "Program Files".
Windows could conceivably be (and most likely has been) installed on a DOS system supporting LFN's and having a preexisting folder named "Program Listings" or "Program anything else here".
Jim Dempsey
- 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

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