<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p>I'm not familiar with <span class="SpellE">GetSaveFileNameA, but
        u</span>sually for the size of a FileName  buffer I use the
      constant MAX_PATH which is defined in unit SysUtils.</p>
    <p>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).</p>
    <p>Did you have a look at Microsoft's documentation for <span
        class="SpellE">GetSaveFileNameA and the OPENFILENAMEA structure
        it takes as parameter ?<br>
<a class="moz-txt-link-freetext" href="https://docs.microsoft.com/en-us/windows/win32/api/commdlg/nf-commdlg-getsavefilenamea">https://docs.microsoft.com/en-us/windows/win32/api/commdlg/nf-commdlg-getsavefilenamea</a></span></p>
    <p><span class="SpellE"><a class="moz-txt-link-freetext" href="https://docs.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-openfilenamea">https://docs.microsoft.com/en-us/windows/win32/api/commdlg/ns-commdlg-openfilenamea</a><br>
        <br>
        Particularly, you need to put in </span><span class="SpellE"><code>nMaxFile
        </code>the size of the buffer pointed to by <font
          face="monospace">lpstrFile</font>. <br>
      </span></p>
    <p>The folowing code works with a 120 characters long filename :</p>
    <p><font face="monospace">program test_GetSaveFileName;<br>
        uses<br>
            SysUtils, CommDlg;<br>
        const DefaultFilename= 'Test';<br>
        var<br>
           Buffer: array[0..MAX_PATH] of Char; //size MAX_PATH + 1 for
        terminating null char<br>
           ofn: TOPENFILENAMEA;<br>
        begin<br>
             StrPLCopy( Buffer, DefaultFilename, MAX_PATH);<br>
             ofn.lStructSize:= sizeof(ofn);<br>
             ofn.hInstance:= 0;<br>
             ofn.lpstrFilter:= nil;<br>
             ofn.lpstrCustomFilter:= nil;<br>
             ofn.nMaxCustFilter:= 0;<br>
             ofn.nFilterIndex:= 0;<br>
             ofn.lpstrFile:= Buffer;<br>
             ofn.nMaxFile:= Sizeof( Buffer);<br>
             ofn.lpstrFileTitle:= nil;<br>
             ofn.nMaxFileTitle:= 0;<br>
             ofn.lpstrInitialDir:= nil;<br>
             ofn.lpstrTitle:= 'test GetSaveFileNameA';<br>
             ofn.Flags:= 0;<br>
             ofn.nFileOffset:= 0;<br>
             ofn.nFileExtension:= 0;<br>
             ofn.lpstrDefExt:= nil;<br>
             ofn.lCustData:= 0;<br>
             ofn.lpfnHook:= nil;<br>
             ofn.lpTemplateName:= nil;<br>
             ofn.pvReserved:= nil;<br>
             ofn.dwReserved:= 0;<br>
             ofn.FlagsEx:= 0;<br>
             if GetSaveFileNameA( @ofn)<br>
             then<br>
                 WriteLn( ofn.lpstrFile);<br>
        end.<br>
      </font><br>
    </p>
  </body>
</html>