[fpc-pascal] GetSaveFileNameA limited to 100 characters in default name

James Richters james.richters at productionautomation.net
Sat Jun 19 02:51:06 CEST 2021

>MAX_PATH itself seems to be an alias from system unit where it is defined
accordingly to the operating system (260 on windows, 4096 on Linux, 1024 on
BSD, Solaris and Darwin).
>It's unlikely, but this way you can end up with the corruption of the byte
right  after the memory block DefaultFileName is pointing to .
This got me thinking. my default filename is just a recommended default. but
TFileName.lpstrFile is also what returns the filename to use, and the user
could use the save-as dialog to add a directory, and change the name of the
file to something else..etc. so the file name could be significantly larger
than the default. 
So I think I'm best off setting TFileName.nMaxFile := Max_Path;  then
TFileName.lpstrFile will always be able to hold anything the operating
system can support. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210618/daf434a2/attachment-0001.htm>

More information about the fpc-pascal mailing list