1

filename.txt

string.h

Consider above filenames, is there any specific meaning of using dot (.) in any file name.

we use it everywhere, in every file.

2 Answers2

2

Generally speaking there's nothing special about it.

However certain operating systems and file systems may assign special meaning to certain characters, but the characters themself are pretty much arbitrary choices.

Back in the old days of DOS, the FAT file system and 8.3 names the . actually was interpreted by the file system to jump to the extension field in the FAT structures; the FAT file system has fixed sized structures for the old short file names.

On modern file systems there's no fixed structure enforced and you may use any character that's not assigned a special meaning by the operating system.

These days you should strictly avoid the characters :, / and \ in file names to avoid cross plattform whoopsie-daysies.

On Windows/NTFS : identifies alternate data streams. / is the *nix path separator, that also works as such on Windows. On Windows \ is the path separator that's usually not understood as such by *nix-y systems (Linux, macOS, *BSD, Android). You can have a lot of fun by putting a \ in a file name on a *nix-y system, share it via CIFS/SMB (i.e. Windows network share) and have the whole thing trip over that.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
0

File readers need to know the extension of the file (to open it in the correct software). Dot is the separator of the file name and it's extension.

Juan Sancho
  • 321
  • 1
  • 7
  • That's not universally applicable. On *nixen the suffix is mostly ignored and file magic bytes used to identify the type of file and the MIME application database, which program to use. – datenwolf Feb 23 '21 at 12:47
  • It can include a common format type, and use extension to read it correctly (ex: CSV) – Juan Sancho Feb 23 '21 at 12:52
  • As I wrote: It's _**mostly**_ ignored. Of course if the file type can not be determined unambiguously from the magic bytes, it will revert to use the suffix. Also some file types, like PKZIP are also used as containers for non "archival" formats, like ODS or OOXML; strictly speaking the later are specified to carry a manifest as the first entry at a specific offset inside the file, to provide the magic bytes. – datenwolf Feb 23 '21 at 12:59