filenames

How to Get the Filename of the Currently Running Executable in C++ [duplicate]

大兔子大兔子 提交于 2020-07-15 02:47:09
问题 This question already has answers here : Get path of executable (22 answers) Closed 2 years ago . I want to get the full path of the current process. I use _getcwd to get the current working directory. But it not includes file name. How can I get file name like: filename.exe ? 回答1: On windows you can use: TCHAR szExeFileName[MAX_PATH]; GetModuleFileName(NULL, szExeFileName, MAX_PATH); szExeFileName will contain full path + executable name [edit] For more portable solution use argv[0] or some

Sorting an array of directory filenames in descending natural order

 ̄綄美尐妖づ 提交于 2020-07-03 12:24:00
问题 I have a content directory to be returned in descending natural order. I'm using scandir() and natsort() , but the addition of array_reverse() yields no results. I've been researching using a combination of opendir() and readdir() as well what ever else to affect this outcome. The items to be sorted are numbered image files. They are to be returned as: 10 9 8 7 and so on, but like from like 1000 999 998 997 ... until 0 Here's my current code: $dir = 'dead_dir/dead_content/'; $launcher =