I'm looking at handling longer file paths in my windows application.
Currently, I have a text box (edit box) in which a user can type an absolute file path. I then read that typed file path, using GetWindowText
, into a string declared like so: TCHAR FilePath[MAX_PATH];
Obviously, here i'm relying on the MAX_PATH
constant which limits me to 260 chars. So to handle longer file/paths names could I just extend my TCHAR array like this: TCHAR FilePath[32767];
.
Or is there a better way? Could I use a variable length array? (TCHAR FilePath[];
is this even possible in C++? - sorry i'm pretty new to this).
Thank you in advanced!
Here's the whole code snippet of what i mentioned above:
TCHAR FilePath[MAX_PATH];
ZeroMemory(&FilePath, sizeof(FilePath));
GetWindowText(hWndFilePath, FilePath, MAX_PATH);