Page 1 of 1

using wxConfigFile

Posted: Fri Apr 25, 2008 4:47 pm
by Qasim
Hi. Iam using wxConfigFile to save application settings. But every time the "MyApp.ini" file is created in C:\Documents and Settings\CURRENT_USER directory.
Is there any way to change its location, something like in "C:\Settings" etc.

I am doing some thing like this (please ignore syntax Errors, if any)

Code: Select all

wxConfigFile* writer= new wxConfigFile("MyApp, Vendor");
writer->SetPath("Mainframe/size")
writer->Write("width",800);
writer->Write("Height",600);
writer->Flush();
delete writer;
Any help will be appreciated.
Cheers

Posted: Fri Apr 25, 2008 5:31 pm
by JudyL
wxFileConfig varFile (wxEmptyString, wxEmptyString, wxEmptyString, "c:\absolutepath\filename", wxCONFIG_USE_GLOBAL_FILE);

Judy

Posted: Fri Apr 25, 2008 5:32 pm
by lester

Code: Select all

  // ctor & dtor
    // New constructor: one size fits all. Specify wxCONFIG_USE_LOCAL_FILE or
    // wxCONFIG_USE_GLOBAL_FILE to say which files should be used.
  wxFileConfig(const wxString& appName = wxEmptyString,
               const wxString& vendorName = wxEmptyString,
               const wxString& localFilename = wxEmptyString,
               const wxString& globalFilename = wxEmptyString,
               long style = wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_GLOBAL_FILE,
               const wxMBConv& conv = wxConvAuto());

Posted: Fri Apr 25, 2008 5:34 pm
by lester

Code: Select all

  wxFileConfig(wxInputStream &inStream, const wxMBConv& conv = wxConvAuto());
may be also useful

Posted: Fri Apr 25, 2008 5:35 pm
by mc2r
Hmmm, I bet all of those could be found in the docs?

-Max

Posted: Fri Apr 25, 2008 5:42 pm
by JudyL
mc2r wrote:Hmmm, I bet all of those could be found in the docs?

-Max
Of course :) I was bored waiting for a compile to finish - bored enough to cut and paste a line from my source code but not bored enough to look up the ctor in the documents

Posted: Fri Apr 25, 2008 6:06 pm
by mc2r
JudyL wrote:
mc2r wrote:Hmmm, I bet all of those could be found in the docs?

-Max
Of course :) I was bored waiting for a compile to finish - bored enough to cut and paste a line from my source code but not bored enough to look up the ctor in the documents
Judy, I think I wasn't clear enough on where the derision was aimed. It was aimed at the OP to be clear ;) Of course if the OP had bothered to look at the docs for the class being questioned then none of us would have had an outlet for our boredom.

-Max

Posted: Fri Apr 25, 2008 6:18 pm
by Sof_T
Judy, I think I wasn't clear enough on where the derision was aimed. It was aimed at the OP to be clear Of course if the OP had bothered to look at the docs for the class being questioned then none of us would have had an outlet for our boredom.
Actually the form of ctor in question is not mentioned in the documentation for wxConfigFile but in the base class wxConfigBase. The documentation for wxConfigFile only shows one form of constructor, so at first glance it is missable, I know I made the same mistake once. :D

Posted: Fri Apr 25, 2008 6:19 pm
by JudyL
Judy, I think I wasn't clear enough on where the derision was aimed. It was aimed at the OP to be clear ;) Of course if the OP had bothered to look at the docs for the class being questioned then none of us would have had an outlet for our boredom.-Max
Rest easy, I knew what you meant. I was still bored (it's a 30 minute compile! :D ) so I responded.