Author | Message | Time |
---|---|---|
R.a.B.B.i.T | WPPS crashes my program whenever I try to use it with a path that has spaces in it. Anyone know (and I know you DO) how to overcome this issue? | July 6, 2005, 1:18 PM |
Myndfyr | Use the Registry. WritePrivateProfileString is deprecated. [quote]Note This function is provided only for compatibility with 16-bit versions of Windows. Applications should store initialization information in the registry.[/quote] [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/writeprivateprofilestring.asp[/url] | July 6, 2005, 7:58 PM |
R.a.B.B.i.T | I want people to be able to edit the values in the ini files without potentially raping their computer, though. Also note that MSDN says:[quote]Applications should store initialization information in the registry.[/quote]and what I want to store is configuration, not initialization, information. | July 6, 2005, 8:40 PM |
UserLoser. | [code] char FileName[MAX_PATH + 1]; GetCurrentDirectory(MAX_PATH - sizeof("\\TestFile.txt"), FileName); strcat(FileName, "\\TestFile.txt"); printf("FileName = %s\r\n", FileName); printf("Return = %08x\r\n", WritePrivateProfileString("AppName", "KeyName", "String", FileName)); getch(); [/code] That works, now show us what you did so we can tell you how wrong you are (or show output from that if it doesn't work) | July 6, 2005, 9:32 PM |
R.a.B.B.i.T | Before I was using GetConsoleLine(), trimming the program name, and adding on the file path I wanted to save to (I deleted this code). It crashed, even when I manually set it to the same place (somewhere on my desktop), as opposed to having the program do that itself (so it wasn't me). I searched Google for about 1.5 hours until I found I could just set the filepath to ".\\file.ini". Thanks for your help, though (I forgot to say it was working). That works, though. | July 7, 2005, 8:59 PM |
Myndfyr | Note that that only works for an application -- running as a service sets the working directory to %SYSTEMROOT%\System32. | July 7, 2005, 10:02 PM |
Adron | [quote author=rabbit link=topic=12094.msg119490#msg119490 date=1120769996] Before I was using GetConsoleLine(), trimming the program name, and adding on the file path I wanted to save to (I deleted this code). It crashed, even when I manually set it to the same place (somewhere on my desktop), as opposed to having the program do that itself (so it wasn't me). I searched Google for about 1.5 hours until I found I could just set the filepath to ".\\file.ini". Thanks for your help, though (I forgot to say it was working). That works, though. [/quote] Sounds like you didn't allocate sufficient space for the string... | July 7, 2005, 11:03 PM |
R.a.B.B.i.T | [code]//crashes WritePrivateProfileString("appName", "keyName", "value", "D:\\Program Files\\file.ini"); //doesn't crash WritePrivateProfileString("appName", "keyName", "value", "D:\\file.ini");[/code] Even that was annoying. | July 8, 2005, 2:56 PM |