I am looking at handling longer file paths in my Windows application.
Currently I have a text box (edit box) in which the user can enter the absolute path to the file. Then I read this typed file path using GetWindowText into a line declared like this: TCHAR FilePath[MAX_PATH];
Obviously, here I rely on the constant MAX_PATH , which limits me to 260 characters. Therefore, to handle longer file and path names, I can simply expand my TCHAR array as follows: TCHAR FilePath[32767]; .
Or is there a better way? Can I use a variable length array? ( TCHAR FilePath[]; is this even possible in C ++? - sorry, I'm pretty new to this).
Thank you for the advanced!
Here's the whole piece of code that I mentioned above:
TCHAR FilePath[MAX_PATH]; ZeroMemory(&FilePath, sizeof(FilePath)); GetWindowText(hWndFilePath, FilePath, MAX_PATH);
c ++ winapi
user353297
source share