On some Windows operating systems (primarily Windows 95, 98, and ME), GetOpenFileName() and GetSaveFileName() (and wrappers of these functions such as MFC’s CFileDialog) will permanently change the process’s current working directory unless the OFN_NOCHANGEDIR option is specified. As you can imagine, this can easily break your application if you ever rely on the current working directory being set to a particular value (such as if you open files using relative paths).
Of course, it is best to eliminate any such current working directory assumptions from your application completely.
http://www.deez.info/sengelha/blog/category/programming/languages/c/
本文讨论了在某些Windows操作系统(如Windows 95、98和ME)中使用GetOpenFileName()和GetSaveFileName()函数及其封装(例如MFC的CFileDialog)时可能会遇到的问题:这些函数若未指定OFN_NOCHANGEDIR选项,则会永久更改进程的当前工作目录。这可能导致应用程序依赖于特定的当前工作目录设置时出现问题,尤其是当使用相对路径打开文件时。
1347

被折叠的 条评论
为什么被折叠?



