GetCommandLine
-
GetCommandLine()
returns a string enclosed in quotation marks. So the first question is why? Let's call this stringstrCmdLine
. Since I had no idea thatstrCmdLine
was enclosed in quotations marks, I would just extract the path of the executable by adding a null character at the location of the very last '\' occurence. So if my path was "c:\\apps\\myapp\\myapp.exe" I would convert the string to "c:\\apps\\myapp\0. As you can see there is a quotation mark at the begining of the string. CallingSetCurrentDirectory()
would work just fine in Windows XP but it doesn't work in Windows 98. I fixed the problem by removing the leading quotation mark but I am puzzled as why would this work in XP and not in 98? This should not work at all. I don't know if it works in other windows versions. // Afterall, I realized that even my comment lines have bugs -
GetCommandLine()
returns a string enclosed in quotation marks. So the first question is why? Let's call this stringstrCmdLine
. Since I had no idea thatstrCmdLine
was enclosed in quotations marks, I would just extract the path of the executable by adding a null character at the location of the very last '\' occurence. So if my path was "c:\\apps\\myapp\\myapp.exe" I would convert the string to "c:\\apps\\myapp\0. As you can see there is a quotation mark at the begining of the string. CallingSetCurrentDirectory()
would work just fine in Windows XP but it doesn't work in Windows 98. I fixed the problem by removing the leading quotation mark but I am puzzled as why would this work in XP and not in 98? This should not work at all. I don't know if it works in other windows versions. // Afterall, I realized that even my comment lines have bugsToni78 wrote: Calling SetCurrentDirectory() would work just fine in Windows XP but it doesn't work in Windows 98. What error is returned by GetLastError()? Can you provide a code snippet?
-
Toni78 wrote: Calling SetCurrentDirectory() would work just fine in Windows XP but it doesn't work in Windows 98. What error is returned by GetLastError()? Can you provide a code snippet?