[fpc-pascal] Function for checking correct file name
Vinzent Höfler
JeLlyFish.software at gmx.net
Sat Sep 15 11:34:08 CEST 2012
On Sat, 15 Sep 2012 11:20:53 +0200, Sven Barth
<pascaldragon at googlemail.com> wrote:
> On 14.09.2012 17:44, Graeme Geldenhuys wrote:
>> On 14/09/12 13:48, Krzysztof wrote:
>>> I just quicky googled not allowed characters and wrote this simple
>>> function:
>>
>> Also in Windows (as far as I know), file names my not be longer than 255
>> characters. So you will have to check the length of AFilename parameter
>> too.
>
> It depends. If you use normal "C:\bla\bla" notation you are right, but
> if you access the NT namespace (which you can do from within the WinAPI)
> you can use paths with up to 32767 characters. You need to use this
> notation though: "\\?\C:\bla\bla" (in this case you MUST use "\" though
> as "/" is not converted here).
Careful. There's a difference between file/component length and path
length.
> For more information see here:
> http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#maxpath
|This type of path is composed of components separated by backslashes,
|each up to the value returned in the lpMaximumComponentLength parameter
|of the GetVolumeInformation function (this value is commonly 255
characters).
So, although the path may be up to 32767 characters in length, each
component
of the path can no longer than 255 characters. This includes the file name.
Vinzent.
--
The most likely way for the world to be destroyed, most experts agree,
is by accident. That's where we come in; we're computer professionals.
We cause accidents.
-- Nathaniel Borenstein
More information about the fpc-pascal
mailing list